Documentation
¶
Overview ¶
Package exp provides a set of tools for building and evaluating expressions.
Index ¶
- Constants
- func Operator(value string) string
- func OperatorOk(value string) (string, bool)
- type AndExpression
- func (e AndExpression) And(exp Expression) Expression
- func (e AndExpression) AndEqual(name string, value any) Expression
- func (e AndExpression) AndGreaterOrEqual(name string, value any) Expression
- func (e AndExpression) AndGreaterThan(name string, value any) Expression
- func (e AndExpression) AndIn(name string, value any) Expression
- func (e AndExpression) AndInAll(field string, values ...any) Expression
- func (e AndExpression) AndLessOrEqual(name string, value any) Expression
- func (e AndExpression) AndLessThan(name string, value any) Expression
- func (e AndExpression) AndNotEqual(name string, value any) Expression
- func (e AndExpression) AndNotIn(name string, value any) Expression
- func (e AndExpression) Fields() []string
- func (e AndExpression) IsEmpty() bool
- func (e AndExpression) Match(fn MatcherFunc) bool
- func (e AndExpression) NotEmpty() bool
- func (e AndExpression) Or(exp Expression) Expression
- func (e AndExpression) OrEqual(name string, value any) Expression
- func (e AndExpression) OrGreaterOrEqual(name string, value any) Expression
- func (e AndExpression) OrGreaterThan(name string, value any) Expression
- func (e AndExpression) OrIn(name string, value any) Expression
- func (e AndExpression) OrInAll(field string, values ...any) Expression
- func (e AndExpression) OrLessOrEqual(name string, value any) Expression
- func (e AndExpression) OrLessThan(name string, value any) Expression
- func (e AndExpression) OrNotEqual(name string, value any) Expression
- func (e AndExpression) OrNotIn(name string, value any) Expression
- type EmptyExpression
- func (e EmptyExpression) And(exp Expression) Expression
- func (e EmptyExpression) AndEqual(name string, value any) Expression
- func (e EmptyExpression) AndGreaterOrEqual(name string, value any) Expression
- func (e EmptyExpression) AndGreaterThan(name string, value any) Expression
- func (e EmptyExpression) AndIn(name string, value any) Expression
- func (e EmptyExpression) AndInAll(name string, value ...any) Expression
- func (e EmptyExpression) AndLessOrEqual(name string, value any) Expression
- func (e EmptyExpression) AndLessThan(name string, value any) Expression
- func (e EmptyExpression) AndNotEqual(name string, value any) Expression
- func (e EmptyExpression) AndNotIn(name string, value any) Expression
- func (e EmptyExpression) Fields() []string
- func (e EmptyExpression) IsEmpty() bool
- func (e EmptyExpression) Match(_ MatcherFunc) bool
- func (e EmptyExpression) NotEmpty() bool
- func (e EmptyExpression) Or(exp Expression) Expression
- func (e EmptyExpression) OrEqual(name string, value any) Expression
- func (e EmptyExpression) OrGreaterOrEqual(name string, value any) Expression
- func (e EmptyExpression) OrGreaterThan(name string, value any) Expression
- func (e EmptyExpression) OrIn(name string, value any) Expression
- func (e EmptyExpression) OrInAll(name string, value ...any) Expression
- func (e EmptyExpression) OrLessOrEqual(name string, value any) Expression
- func (e EmptyExpression) OrLessThan(name string, value any) Expression
- func (e EmptyExpression) OrNotEqual(name string, value any) Expression
- func (e EmptyExpression) OrNotIn(name string, value any) Expression
- type Expression
- type GeoJSONer
- type MatcherFunc
- type OrExpression
- func (e OrExpression) And(exp Expression) Expression
- func (e OrExpression) AndEqual(name string, value any) Expression
- func (e OrExpression) AndGreaterOrEqual(name string, value any) Expression
- func (e OrExpression) AndGreaterThan(name string, value any) Expression
- func (e OrExpression) AndIn(name string, value any) Expression
- func (e OrExpression) AndInAll(field string, values ...any) Expression
- func (e OrExpression) AndLessOrEqual(name string, value any) Expression
- func (e OrExpression) AndLessThan(name string, value any) Expression
- func (e OrExpression) AndNotEqual(name string, value any) Expression
- func (e OrExpression) AndNotIn(name string, value any) Expression
- func (e OrExpression) Fields() []string
- func (e OrExpression) IsEmpty() bool
- func (e OrExpression) Match(fn MatcherFunc) bool
- func (e OrExpression) NotEmpty() bool
- func (e OrExpression) Or(exp Expression) Expression
- func (e OrExpression) OrEqual(name string, value any) Expression
- func (e OrExpression) OrGreaterOrEqual(name string, value any) Expression
- func (e OrExpression) OrGreaterThan(name string, value any) Expression
- func (e OrExpression) OrIn(name string, value any) Expression
- func (e OrExpression) OrInAll(field string, values ...any) Expression
- func (e OrExpression) OrLessOrEqual(name string, value any) Expression
- func (e OrExpression) OrLessThan(name string, value any) Expression
- func (e OrExpression) OrNotEqual(name string, value any) Expression
- func (e OrExpression) OrNotIn(name string, value any) Expression
- type Predicate
- func BeginsWith(field string, value any) Predicate
- func ContainedBy(field string, value any) Predicate
- func Contains(field string, value any) Predicate
- func EndsWith(field string, value any) Predicate
- func Equal(field string, value any) Predicate
- func Exists(field string) Predicate
- func GeoIntersects(field string, geoJSONer GeoJSONer) Predicate
- func GeoWithin(field string, geoJSONer GeoJSONer) Predicate
- func GreaterOrEqual(field string, value any) Predicate
- func GreaterThan(field string, value any) Predicate
- func In(field string, value any) Predicate
- func InAll(field string, value ...any) Predicate
- func LessOrEqual(field string, value any) Predicate
- func LessThan(field string, value any) Predicate
- func New(field string, operator string, value any) Predicate
- func NotEqual(field string, value any) Predicate
- func NotExists(field string) Predicate
- func NotIn(field string, value any) Predicate
- func (predicate Predicate) And(exp Expression) Expression
- func (predicate Predicate) AndEqual(name string, value any) Expression
- func (predicate Predicate) AndGreaterOrEqual(name string, value any) Expression
- func (predicate Predicate) AndGreaterThan(name string, value any) Expression
- func (predicate Predicate) AndIn(name string, value any) Expression
- func (predicate Predicate) AndInAll(name string, value ...any) Expression
- func (predicate Predicate) AndLessOrEqual(name string, value any) Expression
- func (predicate Predicate) AndLessThan(name string, value any) Expression
- func (predicate Predicate) AndNotEqual(name string, value any) Expression
- func (predicate Predicate) AndNotIn(name string, value any) Expression
- func (predicate Predicate) Fields() []string
- func (predicate Predicate) IsEmpty() bool
- func (predicate Predicate) Match(fn MatcherFunc) bool
- func (predicate Predicate) NotEmpty() bool
- func (predicate Predicate) Or(exp Expression) Expression
- func (predicate Predicate) OrEqual(name string, value any) Expression
- func (predicate Predicate) OrGreaterOrEqual(name string, value any) Expression
- func (predicate Predicate) OrGreaterThan(name string, value any) Expression
- func (predicate Predicate) OrIn(name string, value any) Expression
- func (predicate Predicate) OrInAll(name string, value ...any) Expression
- func (predicate Predicate) OrLessOrEqual(name string, value any) Expression
- func (predicate Predicate) OrLessThan(name string, value any) Expression
- func (predicate Predicate) OrNotEqual(name string, value any) Expression
- func (predicate Predicate) OrNotIn(name string, value any) Expression
Constants ¶
const OperatorBeginsWith = "BEGINS"
OperatorBeginsWith represents a "begins with" comparison, when used in Predicates and Criteria. It is only valid for string values.
const OperatorContainedBy = "CONTAINED BY"
OperatorContainedBy represents a "contained by" 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 OperatorExists = "EXISTS"
OperatorExists represents an "exists" comparison, which should return TRUE if the provided field exists.
const OperatorGeoIntersects = "GEO-INTERSECTS"
OperatorGeoIntersects represents a geometric search that intersects with a given shape
const OperatorGeoWithin = "GEO-WITHIN"
OperatorGeoWithin represents a geometric search within a given shape.
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 OperatorIn = "IN"
OperatorIn represents a "in" comparison, when used in Predicates and Criteria.
const OperatorInAll = "IN ALL"
OperatorInAll represents an "in all" 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
const OperatorNotIn = "NOT IN"
OperatorNotIn represents a "not in" comparison, when used in Predicates and Criteria.
Variables ¶
This section is empty.
Functions ¶
func Operator ¶ added in v0.1.0
Operator tries to convert non-standard values into standard operators.
func OperatorOk ¶ added in v0.8.1
OperatorOk tries to convert non-standard values into standard operators. If a match is found, then it returns the standardized value and TRUE. If a match is not found, then the default EQUAL is returned along with a FALSE.
Types ¶
type AndExpression ¶
type AndExpression []Expression
AndExpression combines a series of sub-expressions using AND logic
func All ¶
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) And ¶
func (e AndExpression) And(exp Expression) Expression
And is a part of the Expression interface. It combines another expression into a new AndExpression
func (AndExpression) AndEqual ¶
func (e AndExpression) AndEqual(name string, value any) Expression
AndEqual is a part of the Expression interface. It creates a new AndExpression using the Equal comparison
func (AndExpression) AndGreaterOrEqual ¶
func (e AndExpression) AndGreaterOrEqual(name string, value any) Expression
AndGreaterOrEqual is a part of the Expression interface. It creates a new AndExpression using the GreaterOrEqual comparison
func (AndExpression) AndGreaterThan ¶
func (e AndExpression) AndGreaterThan(name string, value any) Expression
AndGreaterThan is a part of the Expression interface. It creates a new AndExpression using the GreaterThan comparison
func (AndExpression) AndIn ¶ added in v0.1.2
func (e AndExpression) AndIn(name string, value any) Expression
AndIn is a part of the Expression interface. It creates a new AndExpression using the In comparison
func (AndExpression) AndInAll ¶ added in v0.8.4
func (e AndExpression) AndInAll(field string, values ...any) Expression
AndInAll is a part of the Expression interface. It creates a new AndExpression using the InAll comparison
func (AndExpression) AndLessOrEqual ¶
func (e AndExpression) AndLessOrEqual(name string, value any) Expression
AndLessOrEqual is a part of the Expression interface. It creates a new AndExpression using the LessOrEqual comparison
func (AndExpression) AndLessThan ¶
func (e AndExpression) AndLessThan(name string, value any) Expression
AndLessThan is a part of the Expression interface. It creates a new AndExpression using the LessThan comparison
func (AndExpression) AndNotEqual ¶
func (e AndExpression) AndNotEqual(name string, value any) Expression
AndNotEqual is a part of the Expression interface. It creates a new AndExpression using the NotEqual comparison
func (AndExpression) AndNotIn ¶ added in v0.1.2
func (e AndExpression) AndNotIn(name string, value any) Expression
AndNotIn is a part of the Expression interface. It creates a new AndExpression using the NotIn comparison
func (AndExpression) Fields ¶ added in v0.8.5
func (e AndExpression) Fields() []string
Fields is a part of the Expression interface. It returns a slice of field names that are used in this expression.
func (AndExpression) IsEmpty ¶ added in v0.8.0
func (e AndExpression) IsEmpty() bool
IsEmpty is a part of the Expression interface. It returns TRUE if an expression does not have any predicates
func (AndExpression) Match ¶
func (e AndExpression) Match(fn MatcherFunc) bool
Match is a part of the Expression interface. It loops through all sub-expressions and returns TRUE if all of them match
func (AndExpression) NotEmpty ¶ added in v0.8.0
func (e AndExpression) NotEmpty() bool
NotEmpty is a part of the Expression interface. It returns TRUE if an expression has one or more predicates
func (AndExpression) Or ¶ added in v0.1.0
func (e AndExpression) Or(exp Expression) Expression
Or is a part of the Expression interface. It combines this AndExpression with another expression into a new OrExpression
func (AndExpression) OrEqual ¶ added in v0.10.0
func (e AndExpression) OrEqual(name string, value any) Expression
OrEqual is a part of the Expression interface. It creates a new OrExpression using the Equal comparison
func (AndExpression) OrGreaterOrEqual ¶ added in v0.10.0
func (e AndExpression) OrGreaterOrEqual(name string, value any) Expression
OrGreaterOrEqual is a part of the Expression interface. It creates a new OrExpression using the GreaterOrEqual comparison
func (AndExpression) OrGreaterThan ¶ added in v0.10.0
func (e AndExpression) OrGreaterThan(name string, value any) Expression
OrGreaterThan is a part of the Expression interface. It creates a new OrExpression using the GreaterThan comparison
func (AndExpression) OrIn ¶ added in v0.10.0
func (e AndExpression) OrIn(name string, value any) Expression
OrIn is a part of the Expression interface. It creates a new OrExpression using the In comparison
func (AndExpression) OrInAll ¶ added in v0.10.0
func (e AndExpression) OrInAll(field string, values ...any) Expression
OrInAll is a part of the Expression interface. It creates a new OrExpression using the InAll comparison
func (AndExpression) OrLessOrEqual ¶ added in v0.10.0
func (e AndExpression) OrLessOrEqual(name string, value any) Expression
OrLessOrEqual is a part of the Expression interface. It creates a new OrExpression using the LessOrEqual comparison
func (AndExpression) OrLessThan ¶ added in v0.10.0
func (e AndExpression) OrLessThan(name string, value any) Expression
OrLessThan is a part of the Expression interface. It creates a new OrExpression using the LessThan comparison
func (AndExpression) OrNotEqual ¶ added in v0.10.0
func (e AndExpression) OrNotEqual(name string, value any) Expression
OrNotEqual is a part of the Expression interface. It creates a new OrExpression using the NotEqual comparison
func (AndExpression) OrNotIn ¶ added in v0.10.0
func (e AndExpression) OrNotIn(name string, value any) Expression
OrNotIn is a part of the Expression interface. It creates a new OrExpression using the NotIn comparison
type EmptyExpression ¶ added in v0.1.0
type EmptyExpression struct{}
EmptyExpression is an implementation of the Expression interface that represents an empty expression.
func Empty ¶ added in v0.1.0
func Empty() EmptyExpression
Empty creates and returns a new EmptyExpression.
func (EmptyExpression) And ¶ added in v0.1.0
func (e EmptyExpression) And(exp Expression) Expression
And is a part of the Expression interface. It returns the other expression since combining with an empty expression has no effect.
func (EmptyExpression) AndEqual ¶ added in v0.1.2
func (e EmptyExpression) AndEqual(name string, value any) Expression
AndEqual is a part of the Expression interface. It returns an Equal predicate, since there is no existing expression to combine with.
func (EmptyExpression) AndGreaterOrEqual ¶ added in v0.1.2
func (e EmptyExpression) AndGreaterOrEqual(name string, value any) Expression
AndGreaterOrEqual is a part of the Expression interface. It returns a GreaterOrEqual predicate, since there is no existing expression to combine with.
func (EmptyExpression) AndGreaterThan ¶ added in v0.1.2
func (e EmptyExpression) AndGreaterThan(name string, value any) Expression
AndGreaterThan is a part of the Expression interface. It returns a GreaterThan predicate, since there is no existing expression to combine with.
func (EmptyExpression) AndIn ¶ added in v0.1.2
func (e EmptyExpression) AndIn(name string, value any) Expression
AndIn is a part of the Expression interface. It returns an In predicate, since there is no existing expression to combine with.
func (EmptyExpression) AndInAll ¶ added in v0.8.4
func (e EmptyExpression) AndInAll(name string, value ...any) Expression
AndInAll is a part of the Expression interface. It returns an InAll predicate, since there is no existing expression to combine with.
func (EmptyExpression) AndLessOrEqual ¶ added in v0.1.2
func (e EmptyExpression) AndLessOrEqual(name string, value any) Expression
AndLessOrEqual is a part of the Expression interface. It returns a LessOrEqual predicate, since there is no existing expression to combine with.
func (EmptyExpression) AndLessThan ¶ added in v0.1.2
func (e EmptyExpression) AndLessThan(name string, value any) Expression
AndLessThan is a part of the Expression interface. It returns a LessThan predicate, since there is no existing expression to combine with.
func (EmptyExpression) AndNotEqual ¶ added in v0.1.2
func (e EmptyExpression) AndNotEqual(name string, value any) Expression
AndNotEqual is a part of the Expression interface. It returns a NotEqual predicate, since there is no existing expression to combine with.
func (EmptyExpression) AndNotIn ¶ added in v0.1.2
func (e EmptyExpression) AndNotIn(name string, value any) Expression
AndNotIn is a part of the Expression interface. It returns a NotIn predicate, since there is no existing expression to combine with.
func (EmptyExpression) Fields ¶ added in v0.8.5
func (e EmptyExpression) Fields() []string
Fields is a part of the Expression interface. It returns an empty slice since there are no fields in an EmptyExpression.
func (EmptyExpression) IsEmpty ¶ added in v0.8.0
func (e EmptyExpression) IsEmpty() bool
IsEmpty is a part of the Expression interface. It always returns TRUE for an EmptyExpression, since it is always empty.
func (EmptyExpression) Match ¶ added in v0.1.0
func (e EmptyExpression) Match(_ MatcherFunc) bool
Match is a part of the Expression interface. It always returns TRUE for an EmptyExpression, since it matches everything.
func (EmptyExpression) NotEmpty ¶ added in v0.8.0
func (e EmptyExpression) NotEmpty() bool
NotEmpty is a part of the Expression interface. It always returns FALSE for an EmptyExpression, since it is always empty.
func (EmptyExpression) Or ¶ added in v0.1.0
func (e EmptyExpression) Or(exp Expression) Expression
Or is a part of the Expression interface. It returns the other expression since combining with an empty expression has no effect.
func (EmptyExpression) OrEqual ¶ added in v0.10.0
func (e EmptyExpression) OrEqual(name string, value any) Expression
OrEqual is a part of the Expression interface. It returns an Equal predicate, since there is no existing expression to combine with.
func (EmptyExpression) OrGreaterOrEqual ¶ added in v0.10.0
func (e EmptyExpression) OrGreaterOrEqual(name string, value any) Expression
OrGreaterOrEqual is a part of the Expression interface. It returns a GreaterOrEqual predicate, since there is no existing expression to combine with.
func (EmptyExpression) OrGreaterThan ¶ added in v0.10.0
func (e EmptyExpression) OrGreaterThan(name string, value any) Expression
OrGreaterThan is a part of the Expression interface. It returns a GreaterThan predicate, since there is no existing expression to combine with.
func (EmptyExpression) OrIn ¶ added in v0.10.0
func (e EmptyExpression) OrIn(name string, value any) Expression
OrIn is a part of the Expression interface. It returns an In predicate, since there is no existing expression to combine with.
func (EmptyExpression) OrInAll ¶ added in v0.10.0
func (e EmptyExpression) OrInAll(name string, value ...any) Expression
OrInAll is a part of the Expression interface. It returns an InAll predicate, since there is no existing expression to combine with.
func (EmptyExpression) OrLessOrEqual ¶ added in v0.10.0
func (e EmptyExpression) OrLessOrEqual(name string, value any) Expression
OrLessOrEqual is a part of the Expression interface. It returns a LessOrEqual predicate, since there is no existing expression to combine with.
func (EmptyExpression) OrLessThan ¶ added in v0.10.0
func (e EmptyExpression) OrLessThan(name string, value any) Expression
OrLessThan is a part of the Expression interface. It returns a LessThan predicate, since there is no existing expression to combine with.
func (EmptyExpression) OrNotEqual ¶ added in v0.10.0
func (e EmptyExpression) OrNotEqual(name string, value any) Expression
OrNotEqual is a part of the Expression interface. It returns a NotEqual predicate, since there is no existing expression to combine with.
func (EmptyExpression) OrNotIn ¶ added in v0.10.0
func (e EmptyExpression) OrNotIn(name string, value any) Expression
OrNotIn is a part of the Expression interface. It returns a NotIn predicate, since there is no existing expression to combine with.
type Expression ¶
type Expression interface {
// Match evaluates the expression against a MatcherFunc, returning TRUE if the expression matches
Match(MatcherFunc) bool
// And returns a new expression that combines this expression with another as an AndExpression
And(Expression) Expression
// AndEqual is a shortcut that creates a new AndExpression using the Equal comparison
AndEqual(name string, value any) Expression
// AndNotEqual is a shortcut that creates a new AndExpression using the NotEqual comparison
AndNotEqual(name string, value any) Expression
// AndLessThan is a shortcut that creates a new AndExpression using the LessThan comparison
AndLessThan(name string, value any) Expression
// AndLessOrEqual is a shortcut that creates a new AndExpression using the LessOrEqual comparison
AndLessOrEqual(name string, value any) Expression
// AndGreaterThan is a shortcut that creates a new AndExpression using the GreaterThan comparison
AndGreaterThan(name string, value any) Expression
// AndGreaterOrEqual is a shortcut that creates a new AndExpression using the GreaterOrEqual comparison
AndGreaterOrEqual(name string, value any) Expression
// AndIn is a shortcut that creates a new AndExpression using the In comparison
AndIn(name string, value any) Expression
// AndNotIn is a shortcut that creates a new AndExpression using the NotIn comparison
AndNotIn(name string, value any) Expression
// AndInAll is a shortcut that creates a new AndExpression using the InAll comparison
AndInAll(name string, value ...any) Expression
// Or returns a new expression that combines this expression with another as an OrExpression
Or(Expression) Expression
// OrEqual is a shortcut that creates a new OrExpression using the Equal comparison
OrEqual(name string, value any) Expression
// OrNotEqual is a shortcut that creates a new OrExpression using the NotEqual comparison
OrNotEqual(name string, value any) Expression
// OrLessThan is a shortcut that creates a new OrExpression using the LessThan comparison
OrLessThan(name string, value any) Expression
// OrLessOrEqual is a shortcut that creates a new OrExpression using the LessOrEqual comparison
OrLessOrEqual(name string, value any) Expression
// OrGreaterThan is a shortcut that creates a new OrExpression using the GreaterThan comparison
OrGreaterThan(name string, value any) Expression
// OrGreaterOrEqual is a shortcut that creates a new OrExpression using the GreaterOrEqual comparison
OrGreaterOrEqual(name string, value any) Expression
// OrIn is a shortcut that creates a new OrExpression using the In comparison
OrIn(name string, value any) Expression
// OrNotIn is a shortcut that creates a new OrExpression using the NotIn comparison
OrNotIn(name string, value any) Expression
// OrInAll is a shortcut that creates a new OrExpression using the InAll comparison
OrInAll(name string, value ...any) Expression
// IsEmpty returns TRUE if an expression does not have any predicates
IsEmpty() bool
// NotEmpty returns TRUE if an expression has one or more predicates
NotEmpty() bool
// Fields returns the list of fields that are used in this expression
Fields() []string
}
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
func Parse ¶ added in v0.7.0
func Parse(value string) Expression
Parse converts a "field operator value" string into an Expression. Malformed input that does not contain both a field and an operator returns an EmptyExpression instead of panicking.
type GeoJSONer ¶ added in v0.9.0
type GeoJSONer interface {
// GeoJSON returns a GeoJSON representation of the object
GeoJSON() map[string]any
}
GeoJSONer is an interface for types that can represent themselves as GeoJSON
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) And ¶ added in v0.1.0
func (e OrExpression) And(exp Expression) Expression
And is a part of the Expression interface It combines this OrExpression with another expression into a new AndExpression
func (OrExpression) AndEqual ¶ added in v0.1.2
func (e OrExpression) AndEqual(name string, value any) Expression
AndEqual is a part of the Expression interface. It creates a new AndExpression using the Equal comparison
func (OrExpression) AndGreaterOrEqual ¶ added in v0.1.2
func (e OrExpression) AndGreaterOrEqual(name string, value any) Expression
AndGreaterOrEqual is a part of the Expression interface. It creates a new AndExpression using the GreaterOrEqual comparison
func (OrExpression) AndGreaterThan ¶ added in v0.1.2
func (e OrExpression) AndGreaterThan(name string, value any) Expression
AndGreaterThan is a part of the Expression interface. It creates a new AndExpression using the GreaterThan comparison
func (OrExpression) AndIn ¶ added in v0.1.2
func (e OrExpression) AndIn(name string, value any) Expression
AndIn is a part of the Expression interface. It creates a new AndExpression using the In comparison
func (OrExpression) AndInAll ¶ added in v0.8.4
func (e OrExpression) AndInAll(field string, values ...any) Expression
AndInAll is a part of the Expression interface. It creates a new AndExpression using the InAll comparison
func (OrExpression) AndLessOrEqual ¶ added in v0.1.2
func (e OrExpression) AndLessOrEqual(name string, value any) Expression
AndLessOrEqual is a part of the Expression interface. It creates a new AndExpression using the LessOrEqual comparison
func (OrExpression) AndLessThan ¶ added in v0.1.2
func (e OrExpression) AndLessThan(name string, value any) Expression
AndLessThan is a part of the Expression interface. It creates a new AndExpression using the LessThan comparison
func (OrExpression) AndNotEqual ¶ added in v0.1.2
func (e OrExpression) AndNotEqual(name string, value any) Expression
AndNotEqual is a part of the Expression interface. It creates a new AndExpression using the NotEqual comparison
func (OrExpression) AndNotIn ¶ added in v0.1.2
func (e OrExpression) AndNotIn(name string, value any) Expression
AndNotIn is a part of the Expression interface. It creates a new AndExpression using the NotIn comparison
func (OrExpression) Fields ¶ added in v0.8.5
func (e OrExpression) Fields() []string
Fields is a part of the Expression interface. It returns a slice of field names that are used in this expression.
func (OrExpression) IsEmpty ¶ added in v0.8.0
func (e OrExpression) IsEmpty() bool
IsEmpty is a part of the Expression interface. It returns TRUE if an expression does not have any predicates
func (OrExpression) Match ¶
func (e OrExpression) Match(fn MatcherFunc) bool
Match is a part of the Expression interface. It loops through all sub-expressions and returns TRUE if any of them match
func (OrExpression) NotEmpty ¶ added in v0.8.0
func (e OrExpression) NotEmpty() bool
NotEmpty is a part of the Expression interface. It returns TRUE if an expression has one or more predicates
func (OrExpression) Or ¶
func (e OrExpression) Or(exp Expression) Expression
Or is a part of the Expression interface. It combines another expression into a new OrExpression
func (OrExpression) OrEqual ¶ added in v0.10.0
func (e OrExpression) OrEqual(name string, value any) Expression
OrEqual is a part of the Expression interface. It creates a new OrExpression using the Equal comparison
func (OrExpression) OrGreaterOrEqual ¶ added in v0.10.0
func (e OrExpression) OrGreaterOrEqual(name string, value any) Expression
OrGreaterOrEqual is a part of the Expression interface. It creates a new OrExpression using the GreaterOrEqual comparison
func (OrExpression) OrGreaterThan ¶ added in v0.10.0
func (e OrExpression) OrGreaterThan(name string, value any) Expression
OrGreaterThan is a part of the Expression interface. It creates a new OrExpression using the GreaterThan comparison
func (OrExpression) OrIn ¶ added in v0.10.0
func (e OrExpression) OrIn(name string, value any) Expression
OrIn is a part of the Expression interface. It creates a new OrExpression using the In comparison
func (OrExpression) OrInAll ¶ added in v0.10.0
func (e OrExpression) OrInAll(field string, values ...any) Expression
OrInAll is a part of the Expression interface. It creates a new OrExpression using the InAll comparison
func (OrExpression) OrLessOrEqual ¶ added in v0.10.0
func (e OrExpression) OrLessOrEqual(name string, value any) Expression
OrLessOrEqual is a part of the Expression interface. It creates a new OrExpression using the LessOrEqual comparison
func (OrExpression) OrLessThan ¶ added in v0.10.0
func (e OrExpression) OrLessThan(name string, value any) Expression
OrLessThan is a part of the Expression interface. It creates a new OrExpression using the LessThan comparison
func (OrExpression) OrNotEqual ¶ added in v0.10.0
func (e OrExpression) OrNotEqual(name string, value any) Expression
OrNotEqual is a part of the Expression interface. It creates a new OrExpression using the NotEqual comparison
func (OrExpression) OrNotIn ¶ added in v0.10.0
func (e OrExpression) OrNotIn(name string, value any) Expression
OrNotIn is a part of the Expression interface. It creates a new OrExpression using the NotIn comparison
type Predicate ¶
Predicate represents a single true/false comparison
func BeginsWith ¶
BeginsWith creates a new Predicate using an "BeginsWith" comparison
func ContainedBy ¶ added in v0.1.0
ContainedBy creates a new Predicate using an "ContainedBy" comparison
func GeoIntersects ¶ added in v0.9.0
GeoIntersects creates a new Predicate that searches geometric data that INTERSECTS a particular shape
func GeoWithin ¶ added in v0.9.0
GeoWithin creates a new Predicate that searches geometric data WITHIN a particular shape
func GreaterOrEqual ¶
GreaterOrEqual creates a new Predicate using an "Greater Or Equal" comparison
func GreaterThan ¶
GreaterThan creates a new Predicate using an "Greater Than" comparison
func LessOrEqual ¶
LessOrEqual creates a new Predicate using an "Less Or Equal" comparison
func NotExists ¶ added in v0.9.0
NotExists creates a new Predicate using an "Exists:false" comparison
func (Predicate) And ¶
func (predicate Predicate) And(exp Expression) Expression
And combines this predicate with another pre-existing expression into a new And expression
func (Predicate) AndEqual ¶
func (predicate Predicate) AndEqual(name string, value any) Expression
AndEqual combines this predicate with another one (created from the arguments) into an AndExpression
func (Predicate) AndGreaterOrEqual ¶
func (predicate Predicate) AndGreaterOrEqual(name string, value any) Expression
AndGreaterOrEqual combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) AndGreaterThan ¶
func (predicate Predicate) AndGreaterThan(name string, value any) Expression
AndGreaterThan combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) AndIn ¶ added in v0.1.2
func (predicate Predicate) AndIn(name string, value any) Expression
AndIn combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) AndInAll ¶ added in v0.8.4
func (predicate Predicate) AndInAll(name string, value ...any) Expression
AndInAll combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) AndLessOrEqual ¶
func (predicate Predicate) AndLessOrEqual(name string, value any) Expression
AndLessOrEqual combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) AndLessThan ¶
func (predicate Predicate) AndLessThan(name string, value any) Expression
AndLessThan combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) AndNotEqual ¶
func (predicate Predicate) AndNotEqual(name string, value any) Expression
AndNotEqual combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) AndNotIn ¶ added in v0.1.2
func (predicate Predicate) AndNotIn(name string, value any) Expression
AndNotIn combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) Fields ¶ added in v0.8.5
Fields is a part of the Expression interface. It returns a slice of field names that are used in this expression.
func (Predicate) IsEmpty ¶ added in v0.8.0
IsEmpty is a part of the Expression interface. It always returns FALSE for a Predicate, since a Predicate is never empty.
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.
func (Predicate) NotEmpty ¶ added in v0.8.0
NotEmpty is a part of the Expression interface. It always returns TRUE for a Predicate, since a Predicate is never empty.
func (Predicate) Or ¶
func (predicate Predicate) Or(exp Expression) Expression
Or combines this predicate with another pre-existing expression into a new Or expression
func (Predicate) OrEqual ¶ added in v0.6.0
func (predicate Predicate) OrEqual(name string, value any) Expression
OrEqual combines this predicate with another one (created from the arguments) into an OrExpression
func (Predicate) OrGreaterOrEqual ¶ added in v0.6.0
func (predicate Predicate) OrGreaterOrEqual(name string, value any) Expression
OrGreaterOrEqual combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) OrGreaterThan ¶ added in v0.6.0
func (predicate Predicate) OrGreaterThan(name string, value any) Expression
OrGreaterThan combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) OrIn ¶ added in v0.6.0
func (predicate Predicate) OrIn(name string, value any) Expression
OrIn combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) OrInAll ¶ added in v0.8.4
func (predicate Predicate) OrInAll(name string, value ...any) Expression
OrInAll combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) OrLessOrEqual ¶ added in v0.6.0
func (predicate Predicate) OrLessOrEqual(name string, value any) Expression
OrLessOrEqual combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) OrLessThan ¶ added in v0.6.0
func (predicate Predicate) OrLessThan(name string, value any) Expression
OrLessThan combines this predicate with another one (created from the arguments) into an Expression
func (Predicate) OrNotEqual ¶ added in v0.6.0
func (predicate Predicate) OrNotEqual(name string, value any) Expression
OrNotEqual combines this predicate with another one (created from the arguments) into an Expression