Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyConditions ¶
ApplyConditions takes a datastore query and a list of conditions to impose and returns a modified query with those conditions imposed. A condition has the form "field COMPARATOR value" (e.g. `kind == "a"`).
sample usage:
ApplyConditions( q, []Expresson{ NewApplication( "_==_", NewIdentifier("a"), NewConstant("b"), }, )
Types ¶
type Application ¶
type Application struct { Head string Tail []Expression }
An Application is a function application. This is the only kind of node that branches. Anything that takes arguments, whether a connective (&&), a predicate (<=), or a function, is treated as a function application.
type Constant ¶
type Constant struct {
Value interface{}
}
A Constant is a Go value such as "foo" or 4 that represents the value of a CEL constant.
type Expression ¶
type Expression interface {
// contains filtered or unexported methods
}
An Expression is a constant (an int or a string) or an application consisting of head and a tail of expressions.
Alternative #1: an expression is a constant. Alternative #2: an expression is a symbol. Alternative #3: an expression is a fixed function applied to
a list of arguments.
func NewApplication ¶
func NewApplication(head string, tail ...Expression) Expression
NewApplication produces a new application expression.
func NewConstant ¶
func NewConstant(constant interface{}) Expression
NewConstant produces a new constant expression.
func NewIdentifier ¶
func NewIdentifier(identifier string) Expression
NewIdentifier produces a new identifier expression.
func Parse ¶
func Parse(program string) ([]Expression, error)
Parse takes a program and produces a list of expressions. A program in this case is a query in a restricted subset of the CEL language. The only supported programs are comparisons (e.g. a == "foo") combined together using "&&". The expressions returned by parse should be interpreted as implicitly joined together with a variadic "and".
type Identifier ¶
type Identifier struct {
Value string
}
An identifier is a free variable in a filter expression.