-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Order() method support for gdb. #1529
Conversation
|
||
// Order sets the "ORDER BY" statement for the model. | ||
// | ||
// Eg: | ||
// Order("id desc") | ||
// Order("id", "desc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个注释不要删。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,测试没通过debug 的时候发现个问题,这里的 if
判断似乎是无效的,因为下面的 model.orderBy
又被重新赋值了,所以如果链式多次使用 Order()
也是无效的,我看文档确实没有提到多次链式使用 Order()
是设计如此吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我也觉得25行应该改成 +=
,但我PR #1520 的CI一直跑不完不知道为什么
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我也觉得25行应该改成
+=
,但我PR #1520 的CI一直跑不完不知道为什么
改成 +=
之后有些测试用例的结果和预期的是不一样的了,比如测试用例是:Order("status desc").Order("id asc")
, 实际排序是只有id asc
, 而改成 +=
之后就变成了status desc id asc
, 所以 asset()
结果的时候就不对了,你可以本地跑一遍测试用例就知道什么问题了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
多谢,之前没看到github ci里的fail,还以为莫名其妙失败了
@zxr615 你的CI失败了 |
@zxr615 请继续修改撒,如果超过一个月没有活动会关闭哦 |
Codecov Report
@@ Coverage Diff @@
## master #1529 +/- ##
==========================================
- Coverage 70.18% 69.77% -0.42%
==========================================
Files 434 438 +4
Lines 42020 42427 +407
==========================================
+ Hits 29492 29603 +111
- Misses 10652 10927 +275
- Partials 1876 1897 +21
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
因为 1.17 CI 失败了,不知道啥原因,麻烦大佬帮忙看看 |
@gqcn 这个CI提示端口的错误是什么原因呢? |
#1434
本来是想在 doQuoteString(s, charLeft, charRight string) 中做判断,但方法中的参数是
string
类型,而且doQuoteString()
被引用的地方很多,如果改参数s
成interface{}
的话方法名也不太符合原意了,所以就直接在Order()
方法里面修改了,多了个for
循环,似乎不太优雅,大佬可以给给意见。