Documentation ¶
Overview ¶
Package eval contains functions and classes used for evaluating Go expressions used in Capillaries scripts
Index ¶
- Variables
- func DetectRootAggFunc(exp ast.Expr) (AggEnabledType, AggFuncType, []ast.Expr)
- func GetAggStringSeparator(aggFuncArgs []ast.Expr) (string, error)
- type AggDataType
- type AggEnabledType
- type AggFuncType
- type AvgCollector
- type EvalCtx
- func NewPlainEvalCtx(aggEnabled AggEnabledType) EvalCtx
- func NewPlainEvalCtxAndInitializedAgg(aggEnabled AggEnabledType, aggFuncType AggFuncType, aggFuncArgs []ast.Expr) (*EvalCtx, error)
- func NewPlainEvalCtxWithVars(aggEnabled AggEnabledType, vars *VarValuesMap) EvalCtx
- func NewPlainEvalCtxWithVarsAndInitializedAgg(aggEnabled AggEnabledType, vars *VarValuesMap, aggFuncType AggFuncType, ...) (*EvalCtx, error)
- func (eCtx *EvalCtx) CallAggAvg(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggCount(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggMax(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggMin(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggStringAgg(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggSum(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) Eval(exp ast.Expr) (any, error)
- func (eCtx *EvalCtx) EvalBinaryBool(valLeftVolatile any, op token.Token, valRightVolatile any) (bool, error)
- func (eCtx *EvalCtx) EvalBinaryBoolToBool(valLeftVolatile any, op token.Token, valRightVolatile any) (bool, error)
- func (eCtx *EvalCtx) EvalBinaryDecimal2(valLeftVolatile any, op token.Token, valRightVolatile any) (result decimal.Decimal, err error)
- func (eCtx *EvalCtx) EvalBinaryDecimal2ToBool(valLeftVolatile any, op token.Token, valRightVolatile any) (bool, error)
- func (eCtx *EvalCtx) EvalBinaryFloat64(valLeftVolatile any, op token.Token, valRightVolatile any) (float64, error)
- func (eCtx *EvalCtx) EvalBinaryFloat64ToBool(valLeftVolatile any, op token.Token, valRightVolatile any) (bool, error)
- func (eCtx *EvalCtx) EvalBinaryInt(valLeftVolatile any, op token.Token, valRightVolatile any) (result int64, finalErr error)
- func (eCtx *EvalCtx) EvalBinaryIntToBool(valLeftVolatile any, op token.Token, valRightVolatile any) (bool, error)
- func (eCtx *EvalCtx) EvalBinaryString(valLeftVolatile any, op token.Token, valRightVolatile any) (string, error)
- func (eCtx *EvalCtx) EvalBinaryStringToBool(valLeftVolatile any, op token.Token, valRightVolatile any) (bool, error)
- func (eCtx *EvalCtx) EvalBinaryTimeToBool(valLeftVolatile any, op token.Token, valRightVolatile any) (bool, error)
- func (eCtx *EvalCtx) EvalFunc(callExp *ast.CallExpr, funcName string, args []any) (any, error)
- func (eCtx *EvalCtx) EvalUnaryBoolNot(exp ast.Expr) (bool, error)
- func (eCtx *EvalCtx) EvalUnaryMinus(exp ast.Expr) (any, error)
- type MaxCollector
- type MinCollector
- type StringAggCollector
- type SumCollector
- type VarValuesMap
Constants ¶
This section is empty.
Variables ¶
View Source
var GolangConstants = map[string]any{ "time.January": time.January, "time.February": time.February, "time.March": time.March, "time.April": time.April, "time.May": time.May, "time.June": time.June, "time.July": time.July, "time.August": time.August, "time.September": time.September, "time.October": time.October, "time.November": time.November, "time.December": time.December, "time.UTC": time.UTC}
Functions ¶
func DetectRootAggFunc ¶ added in v1.1.4
func DetectRootAggFunc(exp ast.Expr) (AggEnabledType, AggFuncType, []ast.Expr)
Types ¶
type AggDataType ¶
type AggDataType string
const ( AggTypeUnknown AggDataType = "unknown" AggTypeInt AggDataType = "int" AggTypeFloat AggDataType = "float" AggTypeDec AggDataType = "decimal" AggTypeString AggDataType = "string" )
type AggEnabledType ¶
type AggEnabledType int
const ( AggFuncDisabled AggEnabledType = iota AggFuncEnabled )
type AggFuncType ¶
type AggFuncType string
const ( AggStringAgg AggFuncType = "string_agg" AggSum AggFuncType = "sum" AggCount AggFuncType = "count" AggAvg AggFuncType = "avg" AggMin AggFuncType = "min" AggMax AggFuncType = "max" AggUnknown AggFuncType = "unknown" )
func StringToAggFunc ¶
func StringToAggFunc(testString string) AggFuncType
type AvgCollector ¶
type EvalCtx ¶
type EvalCtx struct { Vars *VarValuesMap AggFunc AggFuncType AggType AggDataType AggCallExp *ast.CallExpr Count int64 StringAgg StringAggCollector Sum SumCollector Avg AvgCollector Min MinCollector Max MaxCollector Value any AggEnabled AggEnabledType }
func NewPlainEvalCtx ¶
func NewPlainEvalCtx(aggEnabled AggEnabledType) EvalCtx
func NewPlainEvalCtxAndInitializedAgg ¶ added in v1.1.4
func NewPlainEvalCtxAndInitializedAgg(aggEnabled AggEnabledType, aggFuncType AggFuncType, aggFuncArgs []ast.Expr) (*EvalCtx, error)
func NewPlainEvalCtxWithVars ¶
func NewPlainEvalCtxWithVars(aggEnabled AggEnabledType, vars *VarValuesMap) EvalCtx
func NewPlainEvalCtxWithVarsAndInitializedAgg ¶ added in v1.1.4
func NewPlainEvalCtxWithVarsAndInitializedAgg(aggEnabled AggEnabledType, vars *VarValuesMap, aggFuncType AggFuncType, aggFuncArgs []ast.Expr) (*EvalCtx, error)
func (*EvalCtx) CallAggAvg ¶
func (*EvalCtx) CallAggCount ¶
func (*EvalCtx) CallAggMax ¶
func (*EvalCtx) CallAggMin ¶
func (*EvalCtx) CallAggStringAgg ¶ added in v1.1.4
func (*EvalCtx) CallAggSum ¶
func (*EvalCtx) EvalBinaryBool ¶
func (*EvalCtx) EvalBinaryBoolToBool ¶
func (*EvalCtx) EvalBinaryDecimal2 ¶
func (*EvalCtx) EvalBinaryDecimal2ToBool ¶
func (*EvalCtx) EvalBinaryFloat64 ¶
func (*EvalCtx) EvalBinaryFloat64ToBool ¶
func (*EvalCtx) EvalBinaryInt ¶
func (*EvalCtx) EvalBinaryIntToBool ¶
func (*EvalCtx) EvalBinaryString ¶
func (*EvalCtx) EvalBinaryStringToBool ¶
func (*EvalCtx) EvalBinaryTimeToBool ¶
func (*EvalCtx) EvalUnaryBoolNot ¶
type MaxCollector ¶
type MinCollector ¶
type StringAggCollector ¶ added in v1.1.4
type VarValuesMap ¶
func (*VarValuesMap) Names ¶
func (vars *VarValuesMap) Names() string
func (*VarValuesMap) Tables ¶
func (vars *VarValuesMap) Tables() string
Click to show internal directories.
Click to hide internal directories.