github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/app/lib/filter/ordering.go (about) 1 // Package filter - Content managed by Project Forge, see [projectforge.md] for details. 2 package filter 3 4 import "github.com/kyleu/dbaudit/app/util" 5 6 var OrderingFieldDescs = util.FieldDescs{ 7 {Key: "column", Title: "Column", Description: "The name of the column to sort by"}, 8 {Key: "asc", Title: "Ascending", Description: "Determines if this ordering is applied ascending or descending"}, 9 } 10 11 type Ordering struct { 12 Column string `json:"column"` 13 Asc bool `json:"asc,omitempty"` 14 } 15 16 func (o Ordering) String() string { 17 if o.Asc { 18 return o.Column 19 } 20 return o.Column + ":desc" 21 } 22 23 type Orderings []*Ordering