Order func accept interface{} type but it not order and not error when the value is not an expected type. so why not change it or add a new func. #7303
Labels
type:feature_request
feature request
Describe the feature
The order func is this:
The input is an interface while the switch has no default branch.
So why don't give a func OrderBy() and func OrderByColumn()
Motivation
Some times we use a string-builder to build the order stmt.
While when we pass the custom string-builder type to the Order func. it not return error and not do the order.
For example.
var a = &A{}
a.AppendOrder("name asc")
a.AppendOrder("age desc")
db.Where(...).Order(a).Find(...).Error
same with the logic:
db.Where(...).Find(...).Error
which means no order.
Related Issues
The text was updated successfully, but these errors were encountered: