-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor reuse some simple db.SearchOrderBy #25863
Refactor reuse some simple db.SearchOrderBy #25863
Conversation
I do not think it right to add more "db.SearchOrderXxx", it's an over-design/over-abstraction. In the end, every model/table should have their own "order rules", but not using the shared unclear one. |
The over-designed/over-abstracted shared constants / shared templates already causes problems like #14947 |
I also think that having the same "order rules" common to every model/table is a bit of over-design, so I somehow backed out the While keeping each model/table independent, reusing some simple sorting rules can also reduce the possibility of errors. I think there is a trade-off between reuse and independence. Maybe I should change the title of this PR. |
Maybe we can design a global shareable order rules, like the usage of ps: We have this simple logic mistake for over 3 years, but no one notice it. |
As @yp05327 suggested in #25808 , we should use
db.SearchOrderBy
instead ofsortType
whenever possible. Considering thatdb.SearchOrderBy
can't cover all the complex sorting logic possible, I've made a simple modification to the implementation in improve in #25806.related #25806
close #25808