support sort none
This commit is contained in:
parent
544c621017
commit
b1d5ba8ece
@ -434,9 +434,9 @@ func (t *dbTables) getOrderSQL(orders []*clauses.Order) (orderSQL string) {
|
||||
column := order.GetColumn()
|
||||
var sort string
|
||||
switch order.GetSort() {
|
||||
case clauses.ASCENDING:
|
||||
case clauses.SortAscending:
|
||||
sort = "ASC"
|
||||
case clauses.DESCENDING:
|
||||
case clauses.SortDescending:
|
||||
sort = "DESC"
|
||||
}
|
||||
clause := strings.Split(column, ExprSep)
|
||||
|
||||
@ -3,8 +3,9 @@ package clauses
|
||||
type Sort int8
|
||||
|
||||
const (
|
||||
ASCENDING Sort = 1
|
||||
DESCENDING Sort = 2
|
||||
SortNone Sort = 0
|
||||
SortAscending Sort = 1
|
||||
SortDescending Sort = 2
|
||||
)
|
||||
|
||||
type Order struct {
|
||||
@ -23,10 +24,10 @@ func (o *Order) GetSort() Sort {
|
||||
func ParseOrder(expressions ...string) []*Order {
|
||||
var orders []*Order
|
||||
for _, expression := range expressions {
|
||||
sort := ASCENDING
|
||||
sort := SortAscending
|
||||
column := expression
|
||||
if expression[0] == '-' {
|
||||
sort = DESCENDING
|
||||
sort = SortDescending
|
||||
column = expression[1:]
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user