Documentation ¶
Overview ¶
Package eval contains functions and classes used for evaluating Go expressions used in Capillaries scripts
Index ¶
- Variables
- func DetectRootAggFunc(exp ast.Expr) (string, AggEnabledType, AggFuncType, []ast.Expr)
- func GetAggStringSeparator(funcName string, aggFuncArgs []ast.Expr) (string, error)
- type AggDataType
- type AggEnabledType
- type AggFuncType
- type AvgCollector
- type EvalCtx
- func NewPlainEvalCtx(aggEnabled AggEnabledType) EvalCtx
- func NewPlainEvalCtxAndInitializedAgg(funcName string, aggEnabled AggEnabledType, aggFuncType AggFuncType, ...) (*EvalCtx, error)
- func NewPlainEvalCtxWithVars(aggEnabled AggEnabledType, vars *VarValuesMap) EvalCtx
- func NewPlainEvalCtxWithVarsAndInitializedAgg(funcName string, aggEnabled AggEnabledType, vars *VarValuesMap, ...) (*EvalCtx, error)
- func (eCtx *EvalCtx) CallAggAvg(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggAvgIf(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggCount(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggCountIf(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggMax(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggMaxIf(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggMin(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggMinIf(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggStringAgg(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggStringAggIf(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggSum(callExp *ast.CallExpr, args []any) (any, error)
- func (eCtx *EvalCtx) CallAggSumIf(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) (string, 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" AggStringAggIf AggFuncType = "string_agg_if" AggSum AggFuncType = "sum" AggSumIf AggFuncType = "sum_if" AggCount AggFuncType = "count" AggCountIf AggFuncType = "count_if" AggAvg AggFuncType = "avg" AggAvgIf AggFuncType = "avg_if" AggMin AggFuncType = "min" AggMinIf AggFuncType = "min_if" AggMax AggFuncType = "max" AggMaxIf AggFuncType = "max_if" 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(funcName string, 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(funcName string, aggEnabled AggEnabledType, vars *VarValuesMap, aggFuncType AggFuncType, aggFuncArgs []ast.Expr) (*EvalCtx, error)
func (*EvalCtx) CallAggAvg ¶
func (*EvalCtx) CallAggAvgIf ¶ added in v1.1.19
func (*EvalCtx) CallAggCount ¶
func (*EvalCtx) CallAggCountIf ¶ added in v1.1.19
func (*EvalCtx) CallAggMax ¶
func (*EvalCtx) CallAggMaxIf ¶ added in v1.1.19
func (*EvalCtx) CallAggMin ¶
func (*EvalCtx) CallAggMinIf ¶ added in v1.1.19
func (*EvalCtx) CallAggStringAgg ¶ added in v1.1.4
func (*EvalCtx) CallAggStringAggIf ¶ added in v1.1.19
func (*EvalCtx) CallAggSum ¶
func (*EvalCtx) CallAggSumIf ¶ added in v1.1.19
func (*EvalCtx) Eval ¶
When adding support for another expression here, make sure it's also handled in harvestFieldRefsFromParsedExpression()
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.