-
Notifications
You must be signed in to change notification settings - Fork 5
/
queryData.go
35 lines (29 loc) · 937 Bytes
/
queryData.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package filterparams
import "github.com/cbrand/go-filterparams/definition"
// QueryData represents the completely parsed Query and is returned
// after successful parsing is done.
type QueryData struct {
// Filter represents the structure which should be used to filter
// the set data.
filter interface{}
// Order is a sorted slice of order statements which should be
// sorted by.
order []*definition.Order
}
// GetFilter returns the parsed filter of the QueryData.
func (q *QueryData) GetFilter() interface{} {
return q.filter
}
// GetOrders returns a list of all items which the query should
// be ordered by.
func (q *QueryData) GetOrders() []*definition.Order {
return q.order
}
// NewQueryData initializes a new QueryData struct with all filter information
// of the parameter.
func NewQueryData(filter interface{}, order []*definition.Order) *QueryData {
return &QueryData{
filter: filter,
order: order,
}
}