2020-01-15 04:22:34 +01:00
|
|
|
package model
|
2016-03-02 15:33:49 +01:00
|
|
|
|
2016-03-18 16:33:50 +01:00
|
|
|
import "errors"
|
|
|
|
|
|
|
|
var (
|
2016-03-23 21:30:38 +01:00
|
|
|
ErrNotFound = errors.New("data not found")
|
2016-03-18 16:33:50 +01:00
|
|
|
)
|
|
|
|
|
2020-01-16 05:49:20 +01:00
|
|
|
// Filters use the same operators as Beego ORM: See https://beego.me/docs/mvc/model/query.md#operators
|
|
|
|
// Ex: var q = QueryOptions{Filters: Filters{"name__istartswith": "Deluan","age__gt": 25}}
|
|
|
|
// All conditions will be ANDed together
|
|
|
|
// TODO Implement filter in repositories' methods
|
|
|
|
type Filters map[string]interface{}
|
|
|
|
|
2016-03-04 04:44:28 +01:00
|
|
|
type QueryOptions struct {
|
2020-01-16 05:49:20 +01:00
|
|
|
SortBy string
|
|
|
|
Desc bool
|
|
|
|
Offset int
|
|
|
|
Size int
|
|
|
|
Filters Filters
|
2016-03-04 04:44:28 +01:00
|
|
|
}
|