Documentation
¶
Index ¶
- Variables
- func RemoveStringQuote(target string) string
- type Accessor
- type AccessorValue
- type Args
- type ArgsRef
- type ArithmeticEvalFnGroup
- type ArithmeticEvalMap
- type BinaryOperationExpr
- func (e *BinaryOperationExpr) ChildrenLen() int
- func (e *BinaryOperationExpr) Clone() Evaluable
- func (e *BinaryOperationExpr) Evaluate(ctx EvaluateCtx) (*Primitive, error)
- func (e *BinaryOperationExpr) GetChildAt(idx int) Evaluable
- func (e *BinaryOperationExpr) GetMutChildAt(idx int) *Evaluable
- func (e *BinaryOperationExpr) String() string
- type CondEvalFnGroup
- type CondEvalMap
- type Context
- type Error
- type EvalCond
- type EvalFloat
- type EvalInt
- type Evaluable
- type EvaluateCtx
- type FirstClass
- type FunctionWithCtx
- type Op
- type Parameter
- type Primitive
- func (p *Primitive) AsBool(ctx EvaluateCtx) bool
- func (e *Primitive) ChildrenLen() int
- func (p *Primitive) Clone() Evaluable
- func (p *Primitive) Equal(another *Primitive, ctx EvaluateCtx) bool
- func (p *Primitive) Evaluate(ctx EvaluateCtx) (*Primitive, error)
- func (e *Primitive) GetChildAt(idx int) Evaluable
- func (p *Primitive) GetMutChildAt(idx int) *Evaluable
- func (p *Primitive) IsNil() bool
- func (p *Primitive) String() string
- type ScalarFunction
- func (e *ScalarFunction) ChildrenLen() int
- func (a ScalarFunction) Clone() Evaluable
- func (s ScalarFunction) Evaluate(ctx EvaluateCtx) (*Primitive, error)
- func (e *ScalarFunction) GetChildAt(idx int) Evaluable
- func (e ScalarFunction) GetMutChildAt(idx int) *Evaluable
- func (e ScalarFunction) String() string
- type TernaryOperationExpr
- func (e *TernaryOperationExpr) ChildrenLen() int
- func (e *TernaryOperationExpr) Clone() Evaluable
- func (e *TernaryOperationExpr) Evaluate(ctx EvaluateCtx) (*Primitive, error)
- func (e *TernaryOperationExpr) GetChildAt(idx int) Evaluable
- func (e *TernaryOperationExpr) GetMutChildAt(idx int) *Evaluable
- func (e *TernaryOperationExpr) String() string
- type Type
- type UnaryOperationExpr
- func (e *UnaryOperationExpr) ChildrenLen() int
- func (e *UnaryOperationExpr) Clone() Evaluable
- func (e *UnaryOperationExpr) Evaluate(ctx EvaluateCtx) (child *Primitive, err error)
- func (e *UnaryOperationExpr) GetChildAt(idx int) Evaluable
- func (e *UnaryOperationExpr) GetMutChildAt(idx int) *Evaluable
- func (e UnaryOperationExpr) String() string
- type Variables
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidRegexExpr = errors.New("invalid regex expr") ErrCompileRegexFailed = errors.New("compile regex failed") )
View Source
var ( ErrUnknownAccessorMemberIdentType = errors.New("unknown accessor member ident type") ErrUnknownAccessorAncestorIdentType = errors.New("unknown accessor ancestor ident type") ErrUnknownAccessorAncestorType = errors.New("unknown accessor ancestor type") )
View Source
var BoolFalse = &Primitive{Typ: BOOLEAN, Value: false}
View Source
var BoolTrue = &Primitive{Typ: BOOLEAN, Value: true}
Functions ¶
func RemoveStringQuote ¶
Types ¶
type Accessor ¶
type Accessor struct {
Typ Type
Ancestor Evaluable
Ident Evaluable
// contains filtered or unexported fields
}
func (*Accessor) ChildrenLen ¶
func (*Accessor) GetChildAt ¶
func (*Accessor) GetMutChildAt ¶
type AccessorValue ¶
type Args ¶
type Args []Evaluable
func (Args) ChildrenLen ¶
func (Args) GetChildAt ¶
func (Args) GetMutChildAt ¶
type ArithmeticEvalFnGroup ¶
type ArithmeticEvalFnGroup struct {
// contains filtered or unexported fields
}
type ArithmeticEvalMap ¶
type ArithmeticEvalMap map[Op]ArithmeticEvalFnGroup
type BinaryOperationExpr ¶
func (*BinaryOperationExpr) ChildrenLen ¶
func (e *BinaryOperationExpr) ChildrenLen() int
func (*BinaryOperationExpr) Clone ¶
func (e *BinaryOperationExpr) Clone() Evaluable
func (*BinaryOperationExpr) Evaluate ¶
func (e *BinaryOperationExpr) Evaluate(ctx EvaluateCtx) (*Primitive, error)
func (*BinaryOperationExpr) GetChildAt ¶
func (e *BinaryOperationExpr) GetChildAt(idx int) Evaluable
func (*BinaryOperationExpr) GetMutChildAt ¶
func (e *BinaryOperationExpr) GetMutChildAt(idx int) *Evaluable
func (*BinaryOperationExpr) String ¶
func (e *BinaryOperationExpr) String() string
type CondEvalFnGroup ¶
type CondEvalFnGroup struct {
// contains filtered or unexported fields
}
type CondEvalMap ¶
type CondEvalMap map[Op]CondEvalFnGroup
type Context ¶
type Context struct {
Variables
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
func (Context) AddAccessor ¶
func (ctx Context) AddAccessor(k string, a AccessorValue)
func (Context) AddFunctionWithCtx ¶
func (ctx Context) AddFunctionWithCtx(k string, f FunctionWithCtx)
func (Context) AddParameter ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func (*Error) ChildrenLen ¶
func (*Error) GetChildAt ¶
func (*Error) GetMutChildAt ¶
type Evaluable ¶
type Evaluable interface {
Evaluate(ctx EvaluateCtx) (*Primitive, error)
// GetChildAt returns am immutable ast.Evaluable
GetChildAt(idx int) Evaluable
// GetMutChildAt returns a mutable ref of ast.Evaluable
GetMutChildAt(idx int) *Evaluable
ChildrenLen() int
Clone() Evaluable
String() string
}
func CloneSlice ¶
type EvaluateCtx ¶
type FirstClass ¶
type FirstClass map[string]interface{}
type FunctionWithCtx ¶
type FunctionWithCtx interface {
Eval(ctx EvaluateCtx, args ...Evaluable) (*Primitive, error)
}
type Primitive ¶
func (*Primitive) AsBool ¶
func (p *Primitive) AsBool(ctx EvaluateCtx) bool
AsBool https://developer.mozilla.org/en-US/docs/Glossary/Truthy
func (*Primitive) ChildrenLen ¶
func (*Primitive) GetChildAt ¶
func (*Primitive) GetMutChildAt ¶
type ScalarFunction ¶
func (*ScalarFunction) ChildrenLen ¶
func (e *ScalarFunction) ChildrenLen() int
func (ScalarFunction) Clone ¶
func (a ScalarFunction) Clone() Evaluable
func (ScalarFunction) Evaluate ¶
func (s ScalarFunction) Evaluate(ctx EvaluateCtx) (*Primitive, error)
func (*ScalarFunction) GetChildAt ¶
func (e *ScalarFunction) GetChildAt(idx int) Evaluable
func (ScalarFunction) GetMutChildAt ¶
func (e ScalarFunction) GetMutChildAt(idx int) *Evaluable
func (ScalarFunction) String ¶
func (e ScalarFunction) String() string
type TernaryOperationExpr ¶
func (*TernaryOperationExpr) ChildrenLen ¶
func (e *TernaryOperationExpr) ChildrenLen() int
func (*TernaryOperationExpr) Clone ¶
func (e *TernaryOperationExpr) Clone() Evaluable
func (*TernaryOperationExpr) Evaluate ¶
func (e *TernaryOperationExpr) Evaluate(ctx EvaluateCtx) (*Primitive, error)
func (*TernaryOperationExpr) GetChildAt ¶
func (e *TernaryOperationExpr) GetChildAt(idx int) Evaluable
func (*TernaryOperationExpr) GetMutChildAt ¶
func (e *TernaryOperationExpr) GetMutChildAt(idx int) *Evaluable
func (*TernaryOperationExpr) String ¶
func (e *TernaryOperationExpr) String() string
type UnaryOperationExpr ¶
func (*UnaryOperationExpr) ChildrenLen ¶
func (e *UnaryOperationExpr) ChildrenLen() int
func (*UnaryOperationExpr) Clone ¶
func (e *UnaryOperationExpr) Clone() Evaluable
func (*UnaryOperationExpr) Evaluate ¶
func (e *UnaryOperationExpr) Evaluate(ctx EvaluateCtx) (child *Primitive, err error)
func (*UnaryOperationExpr) GetChildAt ¶
func (e *UnaryOperationExpr) GetChildAt(idx int) Evaluable
func (*UnaryOperationExpr) GetMutChildAt ¶
func (e *UnaryOperationExpr) GetMutChildAt(idx int) *Evaluable
func (UnaryOperationExpr) String ¶
func (e UnaryOperationExpr) String() string
Click to show internal directories.
Click to hide internal directories.