Documentation
¶
Index ¶
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) 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 (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) 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.