Documentation ¶
Index ¶
- Constants
- type AndExpression
- func (andExpression AndExpression) Add(exp Expression) AndExpression
- func (andExpression AndExpression) And(name string, operator string, value interface{}) AndExpression
- func (andExpression AndExpression) AndEqual(name string, value interface{}) AndExpression
- func (andExpression AndExpression) AndGreaterOrEqual(name string, value interface{}) AndExpression
- func (andExpression AndExpression) AndGreaterThan(name string, value interface{}) AndExpression
- func (andExpression AndExpression) AndLessOrEqual(name string, value interface{}) AndExpression
- func (andExpression AndExpression) AndLessThan(name string, value interface{}) AndExpression
- func (andExpression AndExpression) AndNotEqual(name string, value interface{}) AndExpression
- func (andExpression AndExpression) Match(fn MatcherFunc) bool
- type Expression
- type MatcherFunc
- type OrExpression
- type Predicate
- func BeginsWith(field string, value interface{}) Predicate
- func Contains(field string, value interface{}) Predicate
- func EndsWith(field string, value interface{}) Predicate
- func Equal(field string, value interface{}) Predicate
- func GreaterOrEqual(field string, value interface{}) Predicate
- func GreaterThan(field string, value interface{}) Predicate
- func LessOrEqual(field string, value interface{}) Predicate
- func LessThan(field string, value interface{}) Predicate
- func New(field string, operator string, value interface{}) Predicate
- func NotEqual(field string, value interface{}) Predicate
- func (predicate Predicate) And(field string, operator string, value interface{}) AndExpression
- func (predicate Predicate) AndEqual(name string, value interface{}) AndExpression
- func (predicate Predicate) AndGreaterOrEqual(name string, value interface{}) AndExpression
- func (predicate Predicate) AndGreaterThan(name string, value interface{}) AndExpression
- func (predicate Predicate) AndLessOrEqual(name string, value interface{}) AndExpression
- func (predicate Predicate) AndLessThan(name string, value interface{}) AndExpression
- func (predicate Predicate) AndNotEqual(name string, value interface{}) AndExpression
- func (predicate Predicate) Match(fn MatcherFunc) bool
- func (predicate Predicate) Or(field string, operator string, value interface{}) OrExpression
Constants ¶
const OperatorBeginsWith = "BEGINS"
OperatorBeginsWith represents a "begins with" comparison , when used in Predicates and Criteria. It is only valid for string values.
const OperatorContains = "CONTAINS"
OperatorContains represents a "contains" comparison , when used in Predicates and Criteria. It is only valid for string values.
const OperatorEndsWith = "ENDS"
OperatorEndsWith represents a "ends with" comparison , when used in Predicates and Criteria. It is only valid for string values.
const OperatorEqual = "="
OperatorEqual represents an "equals" comparison, when used in Predicates and Criteria
const OperatorGreaterOrEqual = ">="
OperatorGreaterOrEqual represents an "greater or equal" comparison, when used in Predicates and Criteria
const OperatorGreaterThan = ">"
OperatorGreaterThan represents an "greater than" comparison, when used in Predicates and Criteria
const OperatorLessOrEqual = "<="
OperatorLessOrEqual represents an "less or equal" comparison, when used in Predicates and Criteria
const OperatorLessThan = "<"
OperatorLessThan represents a "less than" comparison, when used in Predicates and Criteria
const OperatorNotEqual = "!="
OperatorNotEqual represents a "not equals" comparison, when used in Predicates and Criteria
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AndExpression ¶
type AndExpression []Expression
AndExpression combines a series of sub-expressions using AND logic
func All ¶ added in v0.3.5
func All() AndExpression
All a syntactic sugar alias for And(), so that expressions that query all values in a dataset read nicely.
func And ¶
func And(expressions ...Expression) AndExpression
And combines one or more expression parameters into an AndExpression
func (AndExpression) Add ¶ added in v0.8.0
func (andExpression AndExpression) Add(exp Expression) AndExpression
Add appends a new expression into this compound expression
func (AndExpression) And ¶
func (andExpression AndExpression) And(name string, operator string, value interface{}) AndExpression
And allows an additional predicate into this AndExpression
func (AndExpression) AndEqual ¶ added in v0.9.5
func (andExpression AndExpression) AndEqual(name string, value interface{}) AndExpression
func (AndExpression) AndGreaterOrEqual ¶ added in v0.9.5
func (andExpression AndExpression) AndGreaterOrEqual(name string, value interface{}) AndExpression
func (AndExpression) AndGreaterThan ¶ added in v0.9.5
func (andExpression AndExpression) AndGreaterThan(name string, value interface{}) AndExpression
func (AndExpression) AndLessOrEqual ¶ added in v0.9.5
func (andExpression AndExpression) AndLessOrEqual(name string, value interface{}) AndExpression
func (AndExpression) AndLessThan ¶ added in v0.9.5
func (andExpression AndExpression) AndLessThan(name string, value interface{}) AndExpression
func (AndExpression) AndNotEqual ¶ added in v0.9.5
func (andExpression AndExpression) AndNotEqual(name string, value interface{}) AndExpression
func (AndExpression) Match ¶
func (andExpression AndExpression) Match(fn MatcherFunc) bool
Match implements the Expression interface. It loops through all sub-expressions and returns TRUE if all of them match
type Expression ¶
type Expression interface {
Match(MatcherFunc) bool
}
Expression is an interface that is implemented by Predicates, AndExpressions, and OrExpressions. It enables any of these items to be embedded into the criteria of a data.Query
type MatcherFunc ¶
MatcherFunc is a function signature that is passed in to the .Match() functions of every Expression. It allows the caller to handle the actual matching independently of their underlying data, while the Expression objects handle the program flow.
type OrExpression ¶
type OrExpression []Expression
OrExpression compares a series of sub-expressions, using the OR logic
func Or ¶
func Or(expressions ...Expression) OrExpression
Or combines one or more expression parameters into an OrExpression
func (OrExpression) Add ¶ added in v0.8.0
func (orExpression OrExpression) Add(exp Expression) OrExpression
Add appends a new expression into this compound expression
func (OrExpression) Match ¶
func (orExpression OrExpression) Match(fn MatcherFunc) bool
Match implements the Expression interface. It loops through all sub-expressions and returns TRUE if any of them match
func (OrExpression) Or ¶
func (orExpression OrExpression) Or(name string, operator string, value interface{}) OrExpression
Or appends an additional predicate into the OrExpression
type Predicate ¶
Predicate represents a single true/false comparison
func BeginsWith ¶ added in v0.9.5
BeginsWith creates a new Predicate using an "Greater Or Equal" comparison
func Contains ¶ added in v0.9.5
Contains creates a new Predicate using an "Greater Or Equal" comparison
func EndsWith ¶ added in v0.9.5
EndsWith creates a new Predicate using an "Greater Or Equal" comparison
func GreaterOrEqual ¶ added in v0.9.3
GreaterOrEqual creates a new Predicate using an "Greater Or Equal" comparison
func GreaterThan ¶ added in v0.9.3
GreaterThan creates a new Predicate using an "Greater Than" comparison
func LessOrEqual ¶ added in v0.9.3
LessOrEqual creates a new Predicate using an "Less Or Equal" comparison
func (Predicate) And ¶
func (predicate Predicate) And(field string, operator string, value interface{}) AndExpression
And combines this predicate with another one (created from the arguments) into an AndExpression
func (Predicate) AndEqual ¶ added in v0.10.0
func (predicate Predicate) AndEqual(name string, value interface{}) AndExpression
AndEqual combines this predicate with another one (created from the arguments) into an AndExpression
func (Predicate) AndGreaterOrEqual ¶ added in v0.10.0
func (predicate Predicate) AndGreaterOrEqual(name string, value interface{}) AndExpression
AndGreaterOrEqual combines this predicate with another one (created from the arguments) into an AndExpression
func (Predicate) AndGreaterThan ¶ added in v0.10.0
func (predicate Predicate) AndGreaterThan(name string, value interface{}) AndExpression
AndGreaterThan combines this predicate with another one (created from the arguments) into an AndExpression
func (Predicate) AndLessOrEqual ¶ added in v0.10.0
func (predicate Predicate) AndLessOrEqual(name string, value interface{}) AndExpression
AndLessOrEqual combines this predicate with another one (created from the arguments) into an AndExpression
func (Predicate) AndLessThan ¶ added in v0.10.0
func (predicate Predicate) AndLessThan(name string, value interface{}) AndExpression
AndLessThan combines this predicate with another one (created from the arguments) into an AndExpression
func (Predicate) AndNotEqual ¶ added in v0.10.0
func (predicate Predicate) AndNotEqual(name string, value interface{}) AndExpression
AndNotEqual combines this predicate with another one (created from the arguments) into an AndExpression
func (Predicate) Match ¶
func (predicate Predicate) Match(fn MatcherFunc) bool
Match implements the Expression interface. It uses a MatcherFunc to determine if this predicate matches an arbitrary dataset.