Documentation
¶
Index ¶
- func Between(a Expr) func(x, b Expr) Expr
- func BuiltinFunctions() map[string]func(args ...Expr) (Expr, error)
- func Equal(a, b Expr) bool
- func IsArithmeticOperator(op Operator) bool
- func IsComparisonOperator(op Operator) bool
- func OperatorIsIndexCompatible(op Operator) bool
- func Walk(e Expr, fn func(Expr) bool) bool
- type Aggregator
- type AggregatorBuilder
- type AndOp
- func (op *AndOp) Eval(env *Environment) (document.Value, error)
- func (op AndOp) IsEqual(other Expr) bool
- func (op AndOp) LeftHand() Expr
- func (op AndOp) Precedence() int
- func (op AndOp) RightHand() Expr
- func (op AndOp) SetLeftHandExpr(a Expr)
- func (op AndOp) SetRightHandExpr(b Expr)
- func (op AndOp) String() string
- func (op AndOp) Token() scanner.Token
- type AvgAggregator
- type AvgFunc
- type BetweenOperator
- func (op *BetweenOperator) Eval(env *Environment) (document.Value, error)
- func (op BetweenOperator) IsEqual(other Expr) bool
- func (op BetweenOperator) LeftHand() Expr
- func (op BetweenOperator) Precedence() int
- func (op BetweenOperator) RightHand() Expr
- func (op BetweenOperator) SetLeftHandExpr(a Expr)
- func (op BetweenOperator) SetRightHandExpr(b Expr)
- func (op *BetweenOperator) String() string
- func (op BetweenOperator) Token() scanner.Token
- type CastFunc
- type ConcatOperator
- func (op *ConcatOperator) Eval(env *Environment) (document.Value, error)
- func (op ConcatOperator) IsEqual(other Expr) bool
- func (op ConcatOperator) LeftHand() Expr
- func (op ConcatOperator) Precedence() int
- func (op ConcatOperator) RightHand() Expr
- func (op ConcatOperator) SetLeftHandExpr(a Expr)
- func (op ConcatOperator) SetRightHandExpr(b Expr)
- func (op ConcatOperator) String() string
- func (op ConcatOperator) Token() scanner.Token
- type CountAggregator
- type CountFunc
- type Environment
- func (e *Environment) Clone() (*Environment, error)
- func (e *Environment) Get(path document.Path) (v document.Value, ok bool)
- func (e *Environment) GetDocument() (document.Document, bool)
- func (e *Environment) GetParamByIndex(pos int) (document.Value, error)
- func (e *Environment) GetParamByName(name string) (v document.Value, err error)
- func (e *Environment) GetTx() *database.Transaction
- func (e *Environment) Set(name string, v document.Value)
- func (e *Environment) SetDocument(d document.Document)
- type Expr
- func Add(a, b Expr) Expr
- func And(a, b Expr) Expr
- func BitwiseAnd(a, b Expr) Expr
- func BitwiseOr(a, b Expr) Expr
- func BitwiseXor(a, b Expr) Expr
- func Concat(a, b Expr) Expr
- func Div(a, b Expr) Expr
- func Eq(a, b Expr) Expr
- func Gt(a, b Expr) Expr
- func Gte(a, b Expr) Expr
- func In(a, b Expr) Expr
- func Is(a, b Expr) Expr
- func IsNot(a, b Expr) Expr
- func Like(a, b Expr) Expr
- func Lt(a, b Expr) Expr
- func Lte(a, b Expr) Expr
- func Mod(a, b Expr) Expr
- func Mul(a, b Expr) Expr
- func Neq(a, b Expr) Expr
- func Not(e Expr) Expr
- func NotIn(a, b Expr) Expr
- func NotLike(a, b Expr) Expr
- func Or(a, b Expr) Expr
- func Sub(a, b Expr) Expr
- type Function
- type Functions
- type InOperator
- func (op *InOperator) Eval(env *Environment) (document.Value, error)
- func (op InOperator) IsEqual(other Expr) bool
- func (op InOperator) LeftHand() Expr
- func (op InOperator) Precedence() int
- func (op InOperator) RightHand() Expr
- func (op InOperator) SetLeftHandExpr(a Expr)
- func (op InOperator) SetRightHandExpr(b Expr)
- func (op InOperator) String() string
- func (op InOperator) Token() scanner.Token
- type IsNotOperator
- func (op *IsNotOperator) Eval(env *Environment) (document.Value, error)
- func (op IsNotOperator) IsEqual(other Expr) bool
- func (op IsNotOperator) LeftHand() Expr
- func (op IsNotOperator) Precedence() int
- func (op IsNotOperator) RightHand() Expr
- func (op IsNotOperator) SetLeftHandExpr(a Expr)
- func (op IsNotOperator) SetRightHandExpr(b Expr)
- func (op *IsNotOperator) String() string
- func (op IsNotOperator) Token() scanner.Token
- type IsOperator
- func (op *IsOperator) Eval(env *Environment) (document.Value, error)
- func (op IsOperator) IsEqual(other Expr) bool
- func (op IsOperator) LeftHand() Expr
- func (op IsOperator) Precedence() int
- func (op IsOperator) RightHand() Expr
- func (op IsOperator) SetLeftHandExpr(a Expr)
- func (op IsOperator) SetRightHandExpr(b Expr)
- func (op IsOperator) String() string
- func (op IsOperator) Token() scanner.Token
- type KVPair
- type KVPairs
- type LikeOperator
- func (op *LikeOperator) Eval(env *Environment) (document.Value, error)
- func (op LikeOperator) IsEqual(other Expr) bool
- func (op LikeOperator) LeftHand() Expr
- func (op LikeOperator) Precedence() int
- func (op LikeOperator) RightHand() Expr
- func (op LikeOperator) SetLeftHandExpr(a Expr)
- func (op LikeOperator) SetRightHandExpr(b Expr)
- func (op LikeOperator) String() string
- func (op LikeOperator) Token() scanner.Token
- type LiteralExprList
- type LiteralValue
- type MaxAggregator
- type MaxFunc
- type MinAggregator
- type MinFunc
- type NamedExpr
- type NamedParam
- type NotInOperator
- func (op *NotInOperator) Eval(env *Environment) (document.Value, error)
- func (op NotInOperator) IsEqual(other Expr) bool
- func (op NotInOperator) LeftHand() Expr
- func (op NotInOperator) Precedence() int
- func (op NotInOperator) RightHand() Expr
- func (op NotInOperator) SetLeftHandExpr(a Expr)
- func (op NotInOperator) SetRightHandExpr(b Expr)
- func (op *NotInOperator) String() string
- func (op NotInOperator) Token() scanner.Token
- type NotLikeOperator
- func (op *NotLikeOperator) Eval(env *Environment) (document.Value, error)
- func (op NotLikeOperator) IsEqual(other Expr) bool
- func (op NotLikeOperator) LeftHand() Expr
- func (op NotLikeOperator) Precedence() int
- func (op NotLikeOperator) RightHand() Expr
- func (op NotLikeOperator) SetLeftHandExpr(a Expr)
- func (op NotLikeOperator) SetRightHandExpr(b Expr)
- func (op *NotLikeOperator) String() string
- func (op NotLikeOperator) Token() scanner.Token
- type NotOp
- func (op *NotOp) Eval(env *Environment) (document.Value, error)
- func (op NotOp) IsEqual(other Expr) bool
- func (op NotOp) LeftHand() Expr
- func (op NotOp) Precedence() int
- func (op NotOp) RightHand() Expr
- func (op NotOp) SetLeftHandExpr(a Expr)
- func (op NotOp) SetRightHandExpr(b Expr)
- func (op *NotOp) String() string
- func (op NotOp) Token() scanner.Token
- type Operator
- type OrOp
- func (op *OrOp) Eval(env *Environment) (document.Value, error)
- func (op OrOp) IsEqual(other Expr) bool
- func (op OrOp) LeftHand() Expr
- func (op OrOp) Precedence() int
- func (op OrOp) RightHand() Expr
- func (op OrOp) SetLeftHandExpr(a Expr)
- func (op OrOp) SetRightHandExpr(b Expr)
- func (op OrOp) String() string
- func (op OrOp) Token() scanner.Token
- type PKFunc
- type Param
- type Parentheses
- type Path
- type PositionalParam
- type SumAggregator
- type SumFunc
- type Wildcard
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Between ¶
Between returns a function that creates a BETWEEN operator that returns true if x is between a and b.
func BuiltinFunctions ¶
BuiltinFunctions returns default map of builtin functions.
func Equal ¶
Equal reports whether a and b are equal by first calling IsEqual if they have an IsEqual method with this signature:
IsEqual(Expr) bool
If not, it returns whether a and b values are equal.
func IsArithmeticOperator ¶
IsArithmeticOperator returns true if e is one of +, -, *, /, %, &, |, or ^ operators.
func IsComparisonOperator ¶
IsComparisonOperator returns true if e is one of =, !=, >, >=, <, <=, IS, IS NOT, IN, or NOT IN operators.
func OperatorIsIndexCompatible ¶
OperatorIsIndexCompatible returns whether the operator can be used to read from an index.
Types ¶
type Aggregator ¶
type Aggregator interface { Expr Aggregate(env *Environment) error }
A Aggregator is an expression that aggregates documents into one result.
type AggregatorBuilder ¶
type AggregatorBuilder interface {
Aggregator() Aggregator
}
An AggregatorBuilder is a type that can create aggregators.
type AndOp ¶
type AndOp struct {
// contains filtered or unexported fields
}
AndOp is the And operator.
func (*AndOp) Eval ¶
func (op *AndOp) Eval(env *Environment) (document.Value, error)
Eval implements the Expr interface. It evaluates a and b and returns true if both evaluate to true.
func (AndOp) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (AndOp) Precedence ¶
func (op AndOp) Precedence() int
func (AndOp) SetLeftHandExpr ¶
func (op AndOp) SetLeftHandExpr(a Expr)
func (AndOp) SetRightHandExpr ¶
func (op AndOp) SetRightHandExpr(b Expr)
type AvgAggregator ¶
AvgAggregator is an aggregator that returns the average non-null value.
func (*AvgAggregator) Aggregate ¶
func (s *AvgAggregator) Aggregate(env *Environment) error
Aggregate stores the average value of all non-NULL numeric values in the group.
func (*AvgAggregator) Eval ¶
func (s *AvgAggregator) Eval(env *Environment) (document.Value, error)
Eval returns the aggregated average as a double.
func (*AvgAggregator) String ¶
func (s *AvgAggregator) String() string
type AvgFunc ¶
type AvgFunc struct {
Expr Expr
}
AvgFunc is the AVG aggregator function.
func (*AvgFunc) Aggregator ¶
func (s *AvgFunc) Aggregator() Aggregator
Aggregator returns a AvgFunc. It implements the AggregatorBuilder interface.
func (*AvgFunc) Eval ¶
func (s *AvgFunc) Eval(env *Environment) (document.Value, error)
Eval extracts the average value from the given document and returns it.
type BetweenOperator ¶
type BetweenOperator struct { X Expr // contains filtered or unexported fields }
func (*BetweenOperator) Eval ¶
func (op *BetweenOperator) Eval(env *Environment) (document.Value, error)
func (BetweenOperator) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (BetweenOperator) Precedence ¶
func (op BetweenOperator) Precedence() int
func (BetweenOperator) SetLeftHandExpr ¶
func (op BetweenOperator) SetLeftHandExpr(a Expr)
func (BetweenOperator) SetRightHandExpr ¶
func (op BetweenOperator) SetRightHandExpr(b Expr)
func (*BetweenOperator) String ¶
func (op *BetweenOperator) String() string
type CastFunc ¶
CastFunc represents the CAST expression.
func (CastFunc) Eval ¶
func (c CastFunc) Eval(env *Environment) (document.Value, error)
Eval returns the primary key of the current document.
type ConcatOperator ¶
type ConcatOperator struct {
// contains filtered or unexported fields
}
func (*ConcatOperator) Eval ¶
func (op *ConcatOperator) Eval(env *Environment) (document.Value, error)
func (ConcatOperator) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (ConcatOperator) Precedence ¶
func (op ConcatOperator) Precedence() int
func (ConcatOperator) SetLeftHandExpr ¶
func (op ConcatOperator) SetLeftHandExpr(a Expr)
func (ConcatOperator) SetRightHandExpr ¶
func (op ConcatOperator) SetRightHandExpr(b Expr)
type CountAggregator ¶
CountAggregator is an aggregator that counts non-null expressions.
func (*CountAggregator) Aggregate ¶
func (c *CountAggregator) Aggregate(env *Environment) error
Aggregate increments the counter if the count expression evaluates to a non-null value.
func (*CountAggregator) Eval ¶
func (c *CountAggregator) Eval(env *Environment) (document.Value, error)
Eval returns the result of the aggregation as an integer.
func (*CountAggregator) String ¶
func (c *CountAggregator) String() string
type CountFunc ¶
CountFunc is the COUNT aggregator function. It counts the number of documents in a stream.
func (*CountFunc) Aggregator ¶
func (c *CountFunc) Aggregator() Aggregator
Aggregator returns a CountAggregator. It implements the AggregatorBuilder interface.
type Environment ¶
type Environment struct { Params []Param Vars *document.FieldBuffer Doc document.Document Tx *database.Transaction Outer *Environment }
Environment contains information about the context in which the expression is evaluated.
func NewEnvironment ¶
func NewEnvironment(d document.Document, params ...Param) *Environment
func (*Environment) Clone ¶
func (e *Environment) Clone() (*Environment, error)
func (*Environment) GetDocument ¶
func (e *Environment) GetDocument() (document.Document, bool)
func (*Environment) GetParamByIndex ¶
func (e *Environment) GetParamByIndex(pos int) (document.Value, error)
func (*Environment) GetParamByName ¶
func (e *Environment) GetParamByName(name string) (v document.Value, err error)
func (*Environment) GetTx ¶
func (e *Environment) GetTx() *database.Transaction
func (*Environment) SetDocument ¶
func (e *Environment) SetDocument(d document.Document)
type Expr ¶
type Expr interface { Eval(*Environment) (document.Value, error) String() string }
An Expr evaluates to a value.
func BitwiseAnd ¶
BitwiseAnd creates an expression thats evaluates to the result of a & b.
func BitwiseXor ¶
BitwiseXor creates an expression thats evaluates to the result of a ^ b.
func Concat ¶
Concat creates an expression that concatenates two text values together. It returns null if one of the values is not a text.
type Function ¶
type Function interface { Expr // Returns the list of parameters this function has received. Params() []Expr }
A Function is an expression that execute some arbitrary code.
type Functions ¶
type Functions struct {
// contains filtered or unexported fields
}
Functions represents a map of builtin SQL functions.
func NewFunctions ¶
func NewFunctions() Functions
type InOperator ¶
type InOperator struct {
// contains filtered or unexported fields
}
func (*InOperator) Eval ¶
func (op *InOperator) Eval(env *Environment) (document.Value, error)
func (InOperator) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (InOperator) Precedence ¶
func (op InOperator) Precedence() int
func (InOperator) SetLeftHandExpr ¶
func (op InOperator) SetLeftHandExpr(a Expr)
func (InOperator) SetRightHandExpr ¶
func (op InOperator) SetRightHandExpr(b Expr)
type IsNotOperator ¶
type IsNotOperator struct {
// contains filtered or unexported fields
}
func (*IsNotOperator) Eval ¶
func (op *IsNotOperator) Eval(env *Environment) (document.Value, error)
func (IsNotOperator) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (IsNotOperator) Precedence ¶
func (op IsNotOperator) Precedence() int
func (IsNotOperator) SetLeftHandExpr ¶
func (op IsNotOperator) SetLeftHandExpr(a Expr)
func (IsNotOperator) SetRightHandExpr ¶
func (op IsNotOperator) SetRightHandExpr(b Expr)
func (*IsNotOperator) String ¶
func (op *IsNotOperator) String() string
type IsOperator ¶
type IsOperator struct {
// contains filtered or unexported fields
}
func (*IsOperator) Eval ¶
func (op *IsOperator) Eval(env *Environment) (document.Value, error)
func (IsOperator) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (IsOperator) Precedence ¶
func (op IsOperator) Precedence() int
func (IsOperator) SetLeftHandExpr ¶
func (op IsOperator) SetLeftHandExpr(a Expr)
func (IsOperator) SetRightHandExpr ¶
func (op IsOperator) SetRightHandExpr(b Expr)
type KVPairs ¶
KVPairs is a list of KVPair.
func (KVPairs) Eval ¶
func (kvp KVPairs) Eval(env *Environment) (document.Value, error)
Eval turns a list of KVPairs into a document.
type LikeOperator ¶
type LikeOperator struct {
// contains filtered or unexported fields
}
func (*LikeOperator) Eval ¶
func (op *LikeOperator) Eval(env *Environment) (document.Value, error)
func (LikeOperator) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (LikeOperator) Precedence ¶
func (op LikeOperator) Precedence() int
func (LikeOperator) SetLeftHandExpr ¶
func (op LikeOperator) SetLeftHandExpr(a Expr)
func (LikeOperator) SetRightHandExpr ¶
func (op LikeOperator) SetRightHandExpr(b Expr)
type LiteralExprList ¶
type LiteralExprList []Expr
LiteralExprList is a list of expressions.
func (LiteralExprList) Eval ¶
func (l LiteralExprList) Eval(env *Environment) (document.Value, error)
Eval evaluates all the expressions and returns a litteralValueList. It implements the Expr interface.
func (LiteralExprList) IsEqual ¶
func (l LiteralExprList) IsEqual(other Expr) bool
IsEqual compares this expression with the other expression and returns true if they are equal.
func (LiteralExprList) String ¶
func (l LiteralExprList) String() string
String implements the stringutil.Stringer interface.
type LiteralValue ¶
A LiteralValue represents a litteral value of any type defined by the value package.
func (LiteralValue) Eval ¶
func (v LiteralValue) Eval(*Environment) (document.Value, error)
Eval returns l. It implements the Expr interface.
func (LiteralValue) IsEqual ¶
func (v LiteralValue) IsEqual(other Expr) bool
IsEqual compares this expression with the other expression and returns true if they are equal.
func (LiteralValue) String ¶
func (v LiteralValue) String() string
String implements the stringutil.Stringer interface.
type MaxAggregator ¶
MaxAggregator is an aggregator that returns the minimum non-null value.
func (*MaxAggregator) Aggregate ¶
func (m *MaxAggregator) Aggregate(env *Environment) error
Aggregate stores the maximum value. Values are compared based on their types, then if the type is equal their value is compared. Numbers are considered of the same type.
func (*MaxAggregator) Eval ¶
func (m *MaxAggregator) Eval(env *Environment) (document.Value, error)
Eval return the maximum value.
func (*MaxAggregator) String ¶
func (m *MaxAggregator) String() string
type MaxFunc ¶
type MaxFunc struct {
Expr Expr
}
MaxFunc is the MAX aggregator function.
func (*MaxFunc) Aggregator ¶
func (m *MaxFunc) Aggregator() Aggregator
Aggregator returns a MaxAggregator. It implements the AggregatorBuilder interface.
func (*MaxFunc) Eval ¶
func (m *MaxFunc) Eval(env *Environment) (document.Value, error)
Eval extracts the max value from the given document and returns it.
type MinAggregator ¶
MinAggregator is an aggregator that returns the minimum non-null value.
func (*MinAggregator) Aggregate ¶
func (m *MinAggregator) Aggregate(env *Environment) error
Aggregate stores the minimum value. Values are compared based on their types, then if the type is equal their value is compared. Numbers are considered of the same type.
func (*MinAggregator) Eval ¶
func (m *MinAggregator) Eval(env *Environment) (document.Value, error)
Eval return the minimum value.
func (*MinAggregator) String ¶
func (m *MinAggregator) String() string
type MinFunc ¶
type MinFunc struct {
Expr Expr
}
MinFunc is the MIN aggregator function.
func (*MinFunc) Aggregator ¶
func (m *MinFunc) Aggregator() Aggregator
Aggregator returns a MinAggregator. It implements the AggregatorBuilder interface.
func (*MinFunc) Eval ¶
func (m *MinFunc) Eval(env *Environment) (document.Value, error)
Eval extracts the min value from the given document and returns it.
type NamedParam ¶
type NamedParam string
NamedParam is an expression which represents the name of a parameter.
func (NamedParam) Eval ¶
func (p NamedParam) Eval(env *Environment) (document.Value, error)
Eval looks up for the parameters in the env for the one that has the same name as p and returns the value.
func (NamedParam) IsEqual ¶
func (p NamedParam) IsEqual(other Expr) bool
IsEqual compares this expression with the other expression and returns true if they are equal.
func (NamedParam) String ¶
func (p NamedParam) String() string
String implements the stringutil.Stringer interface.
type NotInOperator ¶
type NotInOperator struct {
InOperator
}
func (*NotInOperator) Eval ¶
func (op *NotInOperator) Eval(env *Environment) (document.Value, error)
func (NotInOperator) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (NotInOperator) Precedence ¶
func (op NotInOperator) Precedence() int
func (NotInOperator) SetLeftHandExpr ¶
func (op NotInOperator) SetLeftHandExpr(a Expr)
func (NotInOperator) SetRightHandExpr ¶
func (op NotInOperator) SetRightHandExpr(b Expr)
func (*NotInOperator) String ¶
func (op *NotInOperator) String() string
type NotLikeOperator ¶
type NotLikeOperator struct {
LikeOperator
}
func (*NotLikeOperator) Eval ¶
func (op *NotLikeOperator) Eval(env *Environment) (document.Value, error)
func (NotLikeOperator) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (NotLikeOperator) Precedence ¶
func (op NotLikeOperator) Precedence() int
func (NotLikeOperator) SetLeftHandExpr ¶
func (op NotLikeOperator) SetLeftHandExpr(a Expr)
func (NotLikeOperator) SetRightHandExpr ¶
func (op NotLikeOperator) SetRightHandExpr(b Expr)
func (*NotLikeOperator) String ¶
func (op *NotLikeOperator) String() string
type NotOp ¶
type NotOp struct {
// contains filtered or unexported fields
}
NotOp is the NOT unary operator.
func (*NotOp) Eval ¶
func (op *NotOp) Eval(env *Environment) (document.Value, error)
Eval implements the Expr interface. It evaluates e and returns true if b is falsy
func (NotOp) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (NotOp) Precedence ¶
func (op NotOp) Precedence() int
func (NotOp) SetLeftHandExpr ¶
func (op NotOp) SetLeftHandExpr(a Expr)
func (NotOp) SetRightHandExpr ¶
func (op NotOp) SetRightHandExpr(b Expr)
type Operator ¶
type Operator interface { Expr Precedence() int LeftHand() Expr RightHand() Expr SetLeftHandExpr(Expr) SetRightHandExpr(Expr) Token() scanner.Token }
An Operator is a binary expression that takes two operands and executes an operation on them.
type OrOp ¶
type OrOp struct {
// contains filtered or unexported fields
}
OrOp is the Or operator.
func (*OrOp) Eval ¶
func (op *OrOp) Eval(env *Environment) (document.Value, error)
Eval implements the Expr interface. It evaluates a and b and returns true if a or b evalutate to true.
func (OrOp) IsEqual ¶
Equal compares this expression with the other expression and returns true if they are equal.
func (OrOp) Precedence ¶
func (op OrOp) Precedence() int
func (OrOp) SetLeftHandExpr ¶
func (op OrOp) SetLeftHandExpr(a Expr)
func (OrOp) SetRightHandExpr ¶
func (op OrOp) SetRightHandExpr(b Expr)
type PKFunc ¶
type PKFunc struct{}
PKFunc represents the pk() function. It returns the primary key of the current document.
func (*PKFunc) Eval ¶
func (k *PKFunc) Eval(env *Environment) (document.Value, error)
Eval returns the primary key of the current document.
type Param ¶
type Param struct { // Name of the param Name string // Value is the parameter value. Value interface{} }
A Param represents a parameter passed by the user to the statement.
type Parentheses ¶
type Parentheses struct {
E Expr
}
Parentheses is a special expression which turns any sub-expression as unary. It hides the underlying operator, if any, from the parser so that it doesn't get reordered by precedence.
func (Parentheses) Eval ¶
func (p Parentheses) Eval(env *Environment) (document.Value, error)
Eval calls the underlying expression Eval method.
func (Parentheses) IsEqual ¶
func (p Parentheses) IsEqual(other Expr) bool
IsEqual compares this expression with the other expression and returns true if they are equal.
func (Parentheses) String ¶
func (p Parentheses) String() string
type Path ¶
A Path is an expression that extracts a value from a document at a given path.
func (Path) Eval ¶
func (p Path) Eval(env *Environment) (document.Value, error)
Eval extracts the current value from the environment and returns the value stored at p. It implements the Expr interface.
type PositionalParam ¶
type PositionalParam int
PositionalParam is an expression which represents the position of a parameter.
func (PositionalParam) Eval ¶
func (p PositionalParam) Eval(env *Environment) (document.Value, error)
Eval looks up for the parameters in the env for the one that is has the same position as p and returns the value.
func (PositionalParam) IsEqual ¶
func (p PositionalParam) IsEqual(other Expr) bool
IsEqual compares this expression with the other expression and returns true if they are equal.
func (PositionalParam) String ¶
func (p PositionalParam) String() string
String implements the stringutil.Stringer interface.
type SumAggregator ¶
SumAggregator is an aggregator that returns the minimum non-null value.
func (*SumAggregator) Aggregate ¶
func (s *SumAggregator) Aggregate(env *Environment) error
Aggregate stores the sum of all non-NULL numeric values in the group. The result is an integer value if all summed values are integers. If any of the value is a double, the returned result will be a double.
func (*SumAggregator) Eval ¶
func (s *SumAggregator) Eval(env *Environment) (document.Value, error)
Eval return the aggregated sum.
func (*SumAggregator) String ¶
func (s *SumAggregator) String() string
type SumFunc ¶
type SumFunc struct {
Expr Expr
}
SumFunc is the SUM aggregator function.
func (*SumFunc) Aggregator ¶
func (s *SumFunc) Aggregator() Aggregator
Aggregator returns a SumFunc. It implements the AggregatorBuilder interface.
func (*SumFunc) Eval ¶
func (s *SumFunc) Eval(env *Environment) (document.Value, error)
Eval extracts the sum value from the given document and returns it.