Versions in this module Expand all Collapse all v0 v0.1.0 May 17, 2024 Changes in this version + const EndIndexValue + const IndexCurrentValue + const IndexKey + const StartIndexValue + func EvaluateOperation(operand1 interface{}, operand2 interface{}, optor Operator) bool + func StringToInterface(value string) interface + type Action interface + type Condition interface + Evaluate func(ctx Context) (interface{}, error) + GetOperator func() Operator + GetValue func() interface{} + type ConditionType int + const ScalarConditionType + const VectorConditionType + type Context interface + GetValue func(key string) ContextValue + KeyExists func(key string) bool + SetValue func(key string, value ContextValue) + func NewContext() Context + type ContextValue interface + type MalformedRuleError struct + func (_rt *MalformedRuleError) Error() string + type Operator string + const AndOperator + const EqualOperator + const GreaterOperator + const GreaterThanOrEqualOperator + const LesserOperator + const LesserThanOrEqualOperator + const NilOperator + const OrOperator + type Rule interface + BuildContext func(ipData []byte, ctx Context) error + Evaluate func(ctx Context) (interface{}, error) + GetType func() RuleType + type RuleContext struct + func (_ctx *RuleContext) GetValue(key string) ContextValue + func (_ctx *RuleContext) KeyExists(key string) bool + func (_ctx *RuleContext) SetValue(key string, value ContextValue) + type RuleEngine struct + func NewRuleEngine() *RuleEngine + func (_re *RuleEngine) Evaluate(fgRule Rule, jsonData []byte) (interface{}, error) + type RuleParser struct + func NewRuleParser(ip string) *RuleParser + func (_p *RuleParser) ParseRule() (Rule, error) + type RuleType int + const ScalarRuleType + const VectorRuleType + type ScalarCondition struct + HasArrayIndex bool + Operand1 Condition + Operand2 Condition + Operator Operator + Type ConditionType + Value interface{} + func (_c *ScalarCondition) Evaluate(ctx Context) (interface{}, error) + func (_c *ScalarCondition) GetOperand1() Condition + func (_c *ScalarCondition) GetOperand2() Condition + func (_c *ScalarCondition) GetOperator() Operator + func (_c *ScalarCondition) GetValue() interface{} + type ScalarRule struct + If Condition + IndexKey interface{} + StartIndex interface{} + Then Action + Type RuleType + func (_fgr *ScalarRule) BuildContext(ipData []byte, ctx Context) error + func (_fgr *ScalarRule) Evaluate(ctx Context) (interface{}, error) + func (_fgr *ScalarRule) GetType() RuleType + type SyntaxError struct + Expected Token + Found Token + Index int + func (_rt *SyntaxError) Error() string + type Token string + const CloseBraceToken + const ColonToken + const CurlyCloseBraceToken + const CurlyOpenBraceToken + const ForToken + const IfToken + const OpenBraceToken + const ThenToken + type VectorCondition struct + EndIndex interface{} + IndexKey string + Operator Operator + SCondition Condition + StartIndex interface{} + Type ConditionType + Value interface{} + func (_c *VectorCondition) Evaluate(ctx Context) (interface{}, error) + func (_c *VectorCondition) GetOperator() Operator + func (_c *VectorCondition) GetValue() interface{} + type VectorRule struct + EndIndex interface{} + IndexKey interface{} + SRule Rule + StartIndex interface{} + Type RuleType + func (_fgr *VectorRule) BuildContext(ipData []byte, ctx Context) error + func (_fgr *VectorRule) Evaluate(ctx Context) (interface{}, error) + func (_fgr *VectorRule) GetType() RuleType