增加排序设置的简化操作
This commit is contained in:
parent
4027af2a6c
commit
c2548cd930
28
option.go
28
option.go
@ -318,3 +318,31 @@ func WithOrder(orderRuleList ...string) SetOption {
|
|||||||
o.Order = orderRuleList
|
o.Order = orderRuleList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithOrderDesc 降序排序
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 15:09 2023/4/3
|
||||||
|
func WithOrderDesc(field string) SetOption {
|
||||||
|
return func(o *Option) {
|
||||||
|
if nil == o.Order {
|
||||||
|
o.Order = make([]string, 0)
|
||||||
|
}
|
||||||
|
o.Order = append(o.Order, field+" desc")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithOrderAsc 升序排序
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 15:09 2023/4/3
|
||||||
|
func WithOrderAsc(field string) SetOption {
|
||||||
|
return func(o *Option) {
|
||||||
|
if nil == o.Order {
|
||||||
|
o.Order = make([]string, 0)
|
||||||
|
}
|
||||||
|
o.Order = append(o.Order, field+" asc")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user