Core

/app/lib/filter/ordering.go (507 B)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package filter

import "{{{ .Package }}}/app/util"

var OrderingFieldDescs = util.FieldDescs{
{Key: "column", Title: "Column", Description: "The name of the column to sort by"},
{Key: "asc", Title: "Ascending", Description: "Determines if this ordering is applied ascending or descending"},
}

type Ordering struct {
Column string `json:"column"`
Asc bool `json:"asc"`
}

func (o Ordering) String() string {
if o.Asc {
return o.Column
}
return o.Column + ":desc"
}

type Orderings []*Ordering