feat(order): support call Order once to order by multi fields
This commit is contained in:
parent
3a3b82263a
commit
0c66383e6a
@ -219,6 +219,12 @@ func (db *DB) Order(value interface{}) (tx *DB) {
|
||||
tx.Statement.AddClause(clause.OrderBy{
|
||||
Columns: []clause.OrderByColumn{v},
|
||||
})
|
||||
|
||||
case clause.OrderByColumns:
|
||||
tx.Statement.AddClause(clause.OrderBy{
|
||||
Columns: v,
|
||||
})
|
||||
|
||||
case string:
|
||||
if v != "" {
|
||||
tx.Statement.AddClause(clause.OrderBy{
|
||||
|
@ -6,6 +6,8 @@ type OrderByColumn struct {
|
||||
Reorder bool
|
||||
}
|
||||
|
||||
type OrderByColumns = []OrderByColumn
|
||||
|
||||
type OrderBy struct {
|
||||
Columns []OrderByColumn
|
||||
Expression Expression
|
||||
|
Loading…
x
Reference in New Issue
Block a user