Documentation ¶
Index ¶
- Variables
- func IsExactMatchOperator(operator string) bool
- func IsInvertingOperator(operator string) bool
- func Render(generator IGenerator, collectionName string, filter *Filter) ([]byte, error)
- func SplitModifierToken(in string) (string, string)
- type Aggregate
- type Aggregation
- type ConjunctionType
- type Criterion
- type Filter
- func (self *Filter) AddCriteria(criteria ...Criterion) *Filter
- func (self *Filter) ApplyOptions(in interface{}) error
- func (self *Filter) BoundedBy(limit int, offset int) *Filter
- func (self *Filter) CriteriaFields() []string
- func (self *Filter) GetFirstValue() (interface{}, bool)
- func (self *Filter) GetIdentityValue() (interface{}, bool)
- func (self *Filter) GetSort() []SortBy
- func (self *Filter) GetValues(field string) ([]interface{}, bool)
- func (self *Filter) IdOnly() bool
- func (self *Filter) IsMatchAll() bool
- func (self *Filter) MatchesRecord(record *dal.Record) bool
- func (self *Filter) NewFromMap(in map[string]interface{}) (*Filter, error)
- func (self *Filter) NewFromSpec(specs ...string) (*Filter, error)
- func (self *Filter) SortBy(fields ...string) *Filter
- func (self *Filter) String() string
- func (self *Filter) WithFields(fields ...string) *Filter
- type Generator
- type IGenerator
- type NormalizerFunc
- type SortBy
Constants ¶
This section is empty.
Variables ¶
View Source
var AllValue = `all`
View Source
var CriteriaSeparator = `/`
View Source
var DefaultIdentityField = `id`
View Source
var DefaultNormalizerFunc = func(in string) string { in = strings.ToLower(in) return rxCharFilter.ReplaceAllString(in, ``) }
View Source
var FieldLengthDelimiter = `#`
View Source
var FieldTermSeparator = `/`
View Source
var ModifierDelimiter = `:`
View Source
var QueryUnescapeValues = false
View Source
var SortAscending = `+`
View Source
var SortDescending = `-`
View Source
var ValueSeparator = `|`
Functions ¶
func IsExactMatchOperator ¶
func IsInvertingOperator ¶
func Render ¶
func Render(generator IGenerator, collectionName string, filter *Filter) ([]byte, error)
func SplitModifierToken ¶
Types ¶
type Aggregate ¶
type Aggregate struct { Aggregation Aggregation Field string }
type Aggregation ¶
type Aggregation int
const ( First Aggregation = iota Last Minimum Maximum Sum Average Count )
type ConjunctionType ¶
type ConjunctionType string
const ( AndConjunction ConjunctionType = `` OrConjunction = `or` )
type Criterion ¶
type Criterion struct { Type dal.Type `json:"type,omitempty"` Length int `json:"length,omitempty"` Field string `json:"field"` Operator string `json:"operator,omitempty"` Values []interface{} `json:"values"` Aggregation Aggregation `json:"aggregation,omitempty"` }
func (*Criterion) IsExactMatch ¶ added in v3.0.7
type Filter ¶
type Filter struct { Spec string MatchAll bool Offset int Limit int Criteria []Criterion Sort []string Fields []string Options map[string]interface{} Paginate bool IdentityField string Normalizer NormalizerFunc `json:"-" bson:"-" pivot:"-"` Conjunction ConjunctionType }
func MakeFilter ¶
func (*Filter) AddCriteria ¶
func (*Filter) ApplyOptions ¶
func (*Filter) CriteriaFields ¶
func (*Filter) GetFirstValue ¶
func (*Filter) GetIdentityValue ¶
func (*Filter) IsMatchAll ¶
func (*Filter) NewFromMap ¶
func (*Filter) WithFields ¶
type Generator ¶
type Generator struct { IGenerator // contains filtered or unexported fields }
type IGenerator ¶
type IGenerator interface { Initialize(string) error Finalize(*Filter) error Push([]byte) Set([]byte) Payload() []byte WithCriterion(Criterion) error OrCriterion(Criterion) error WithField(string) error GroupByField(string) error AggregateByField(Aggregation, string) error SetOption(string, interface{}) error GetValues() []interface{} Reset() }
type NormalizerFunc ¶
Click to show internal directories.
Click to hide internal directories.