context

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FactNotFoundError  = errors.New("Fact not found")
	FactRetractedError = errors.New("Fact is retracted")
)

Functions

This section is empty.

Types

type DataContext

type DataContext struct {
	ObjectStore         map[string]interface{}
	Retracted           []string
	VariableChangeCount uint64
}

DataContext holds all structs instance to be used in rule execution environment.

func NewDataContext

func NewDataContext() *DataContext

NewDataContext will create a new DataContext instance

func (*DataContext) Add

func (ctx *DataContext) Add(key string, obj interface{}) error

Add will add struct instance into rule execution context

func (*DataContext) ExecMethod

func (ctx *DataContext) ExecMethod(methodName string, args []reflect.Value) (reflect.Value, error)

ExecMethod will execute instance member variable using the supplied arguments.

func (*DataContext) GetType

func (ctx *DataContext) GetType(variable string) (reflect.Type, error)

GetType will extract type information of data in this context.

func (*DataContext) GetValue

func (ctx *DataContext) GetValue(variable string) (reflect.Value, error)

GetValue will get member variables Value information. Used by the rule execution to obtain variable value.

func (*DataContext) IsRestracted

func (ctx *DataContext) IsRestracted(key string) bool

IsRestracted checks if a key fact is currently retracted.

func (*DataContext) Reset

func (ctx *DataContext) Reset()

Reset will un-retract all fact, making them available for evaluation and modification.

func (*DataContext) Retract

func (ctx *DataContext) Retract(key string)

Retract temporary retract a fact from data context, making it unavailable for evaluation or modification.

func (*DataContext) SetValue

func (ctx *DataContext) SetValue(variable string, newValue reflect.Value) error

SetValue will set variable value of an object instance in this data context, Used by rule script to set values.

type KnowledgeContext

type KnowledgeContext struct {
}

type RuleContext

type RuleContext struct {
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL