Versions in this module Expand all Collapse all v1 v1.0.2 Mar 23, 2023 v1.0.1 Mar 23, 2023 Changes in this version + var BREAKFLAG = errors.New("break") + var CONTINUEFLAG = errors.New("break") + var TypeMap = map[string]string + type Arg struct + Constant *Constant + Expression *Expression + FunctionCall *FunctionCall + MapVar *MapVar + MethodCall *MethodCall + ThreeLevelCall *ThreeLevelCall + Variable string + func (a *Arg) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error) + type Args struct + ArgList []*Arg + func (as *Args) AcceptConstant(cons *Constant) error + func (as *Args) AcceptExpression(exp *Expression) error + func (as *Args) AcceptFunctionCall(funcCall *FunctionCall) error + func (as *Args) AcceptMapVar(mapVar *MapVar) error + func (as *Args) AcceptMethodCall(methodCall *MethodCall) error + func (as *Args) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error + func (as *Args) AcceptVariable(name string) error + func (as *Args) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) ([]reflect.Value, error) + type ArgsHolder interface + AcceptArgs func(funcArg *Args) error + type Assignment struct + AssignOperator string + Expression *Expression + MapVar *MapVar + MathExpression *MathExpression + Variable string + func (a *Assignment) AcceptExpression(exp *Expression) error + func (a *Assignment) AcceptMapVar(mapVar *MapVar) error + func (a *Assignment) AcceptMathExpression(me *MathExpression) error + func (a *Assignment) AcceptVariable(name string) error + func (a *Assignment) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (value reflect.Value, err error) + type AssignmentHolder interface + AcceptAssignment func(a *Assignment) error + type AtDescHolder interface + AcceptDesc func(val string) error + type AtIdHolder interface + AcceptId func(val int64) error + type AtNameHolder interface + AcceptName func(val string) error + type AtSalienceHolder interface + AcceptSalience func(val int64) error + type BreakStmt struct + func (forStmt *BreakStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type ConcStatement struct + Assignments []*Assignment + FunctionCalls []*FunctionCall + MethodCalls []*MethodCall + ThreeLevelCalls []*ThreeLevelCall + func (cs *ConcStatement) AcceptAssignment(assignment *Assignment) error + func (cs *ConcStatement) AcceptFunctionCall(funcCall *FunctionCall) error + func (cs *ConcStatement) AcceptMethodCall(methodCall *MethodCall) error + func (cs *ConcStatement) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error + func (cs *ConcStatement) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error) + type Constant struct + ConstantValue reflect.Value + func (cons *Constant) AcceptDesc(desc string) error + func (cons *Constant) AcceptId(id int64) error + func (cons *Constant) AcceptInteger(i64 int64) error + func (cons *Constant) AcceptName(name string) error + func (cons *Constant) AcceptSalience(sal int64) error + func (cons *Constant) AcceptString(str string) error + func (cons *Constant) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error) + type ConstantHolder interface + AcceptConstant func(cons *Constant) error + type ContinueStmt struct + func (continueStmt *ContinueStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type ElseIfStmt struct + Expression *Expression + StatementList *Statements + func (ef *ElseIfStmt) AcceptExpression(expr *Expression) error + func (ef *ElseIfStmt) AcceptStatements(stmts *Statements) error + func (ef *ElseIfStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type ElseStmt struct + StatementList *Statements + func (e *ElseStmt) AcceptStatements(stmts *Statements) error + func (e *ElseStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type Expression struct + ComparisonOperator string + ExpressionAtom *ExpressionAtom + ExpressionLeft *Expression + ExpressionRight *Expression + LogicalOperator string + MathExpression *MathExpression + NotOperator string + func (e *Expression) AcceptExpression(expression *Expression) error + func (e *Expression) AcceptExpressionAtom(atom *ExpressionAtom) error + func (e *Expression) AcceptMathExpression(atom *MathExpression) error + func (e *Expression) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error) + type ExpressionAtom struct + Constant *Constant + FunctionCall *FunctionCall + MapVar *MapVar + MethodCall *MethodCall + ThreeLevelCall *ThreeLevelCall + Variable string + func (e *ExpressionAtom) AcceptConstant(cons *Constant) error + func (e *ExpressionAtom) AcceptFunctionCall(funcCall *FunctionCall) error + func (e *ExpressionAtom) AcceptMapVar(mapVar *MapVar) error + func (e *ExpressionAtom) AcceptMethodCall(methodCall *MethodCall) error + func (e *ExpressionAtom) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error + func (e *ExpressionAtom) AcceptVariable(name string) error + func (e *ExpressionAtom) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error) + type ExpressionAtomHolder interface + AcceptExpressionAtom func(atom *ExpressionAtom) error + type ExpressionHolder interface + AcceptExpression func(expression *Expression) error + type ForRangeStmt struct + StatementList *Statements + func (forRangeStmt *ForRangeStmt) AcceptStatements(stmts *Statements) error + func (forRangeStmt *ForRangeStmt) AcceptVariable(name string) error + func (forRangeStmt *ForRangeStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type ForStmt struct + Assignments []*Assignment + Expression *Expression + StatementList *Statements + func (forStmt *ForStmt) AcceptAssignment(assignment *Assignment) error + func (forStmt *ForStmt) AcceptExpression(expr *Expression) error + func (forStmt *ForStmt) AcceptStatements(stmts *Statements) error + func (forStmt *ForStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type FunctionCall struct + FunctionArgs *Args + FunctionName string + func (fc *FunctionCall) AcceptArgs(funcArg *Args) error + func (fc *FunctionCall) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (res reflect.Value, err error) + type FunctionCallHolder interface + AcceptFunctionCall func(funcCall *FunctionCall) error + type IfStmt struct + ElseIfStmtList []*ElseIfStmt + ElseStmt *ElseStmt + Expression *Expression + StatementList *Statements + func (i *IfStmt) AcceptExpression(expr *Expression) error + func (i *IfStmt) AcceptStatements(stmts *Statements) error + func (i *IfStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type IntegerHolder interface + AcceptInteger func(val int64) error + type KnowledgeContext struct + RuleEntities map[string]*RuleEntity + SortRules []*RuleEntity + SortRulesIndexMap map[string]int + func NewKnowledgeContext() *KnowledgeContext + func (k *KnowledgeContext) ClearRules() + type MapVar struct + Intkey int64 + Name string + Strkey string + Varkey string + func (m *MapVar) AcceptInteger(i64 int64) error + func (m *MapVar) AcceptString(str string) error + func (m *MapVar) AcceptVariable(name string) error + func (m *MapVar) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error) + type MapVarHolder interface + AcceptMapVar func(mv *MapVar) error + type MathExpression struct + ExpressionAtom *ExpressionAtom + MathExpressionLeft *MathExpression + MathExpressionRight *MathExpression + MathMdOperator string + MathPmOperator string + func (e *MathExpression) AcceptExpressionAtom(atom *ExpressionAtom) error + func (e *MathExpression) AcceptMathExpression(atom *MathExpression) error + func (e *MathExpression) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error) + type MathExpressionHolder interface + AcceptMathExpression func(mh *MathExpression) error + type MethodCall struct + MethodArgs *Args + MethodName string + func (mc *MethodCall) AcceptArgs(funcArg *Args) error + func (mc *MethodCall) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (mr reflect.Value, err error) + type MethodCallHolder interface + AcceptMethodCall func(methodCall *MethodCall) error + type ReturnStatement struct + Expression *Expression + func (rs *ReturnStatement) AcceptExpression(expr *Expression) error + func (rs *ReturnStatement) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type RuleContent struct + Statements *Statements + func (t *RuleContent) AcceptStatements(stmts *Statements) error + func (t *RuleContent) Execute(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type RuleEntity struct + RuleContent *RuleContent + RuleDescription string + RuleName string + Salience int64 + func (r *RuleEntity) AcceptInteger(val int64) error + func (r *RuleEntity) AcceptString(s string) error + func (r *RuleEntity) Execute(dc *context.DataContext) (interface{}, error, bool) + type SourceCode struct + Code string + Column int + LineNum int + LineStop int + type Statement struct + Assignment *Assignment + BreakStmt *BreakStmt + ConcStatement *ConcStatement + ContinueStmt *ContinueStmt + ForRangeStmt *ForRangeStmt + ForStmt *ForStmt + FunctionCall *FunctionCall + IfStmt *IfStmt + MethodCall *MethodCall + ThreeLevelCall *ThreeLevelCall + func (s *Statement) AcceptAssignment(assignment *Assignment) error + func (s *Statement) AcceptFunctionCall(funcCall *FunctionCall) error + func (s *Statement) AcceptMethodCall(methodCall *MethodCall) error + func (s *Statement) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error + func (s *Statement) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type Statements struct + ReturnStatement *ReturnStatement + StatementList []*Statement + func (s *Statements) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool) + type StatementsHolder interface + AcceptStatements func(statement *Statements) error + type StringHolder interface + AcceptString func(str string) error + type ThreeLevelCall struct + MethodArgs *Args + ThreeLevel string + func (tlc *ThreeLevelCall) AcceptArgs(funcArg *Args) error + func (tlc *ThreeLevelCall) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (mr reflect.Value, err error) + type ThreeLevelCallHolder interface + AcceptThreeLevelCall func(threeLevelCall *ThreeLevelCall) error + type VariableHolder interface + AcceptVariable func(name string) error