Skip to content

Commit 423786c

Browse files
author
timsolov
committed
add func for directly adding sorting parameters
1 parent a2252f2 commit 423786c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ func (p *Query) HaveSortBy(by string) bool {
188188
return false
189189
}
190190

191+
// AddSortBy adds an order rule to Query
192+
func (q *Query) AddSortBy(by string, desc bool) *Query {
193+
q.Sorts = append(q.Sorts, Sort{
194+
By: by,
195+
Desc: desc,
196+
})
197+
return q
198+
}
199+
191200
// HaveFilter returns true if request contains some filter
192201
func (p *Query) HaveFilter(name string) bool {
193202

0 commit comments

Comments
 (0)