Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidDataType invalid data type ErrInvalidDataType = errors.New("invalid data type") // ErrInvalidValueType invalid value type ErrInvalidValueType = errors.New("invalid value type") // ErrContextUpdateRecovered recovered context update after panic ErrContextUpdateRecovered = errors.New("recovered context update after panic") // ErrRegisteredObjectMustBePointer error registering object must be a pointer ErrRegisteredObjectMustBePointer = errors.New("error registering object must be a pointer") // ErrMalformedTag malformed tag ErrMalformedTag = errors.New("malformed tag") // ErrEmptyThenSentence empty 'then' sentence in rule ErrEmptyThenSentence = errors.New("empty 'then' sentence in rule") // ErrEmptyConditionList the rule must contains at least one condition ErrEmptyConditionList = errors.New("the rule must contains at least one condition") // ErrNilObject nil object ErrNilObject = errors.New("nil object") // ErrFactNotFound fact not found ErrFactNotFound = errors.New("fact not found") // ErrFactInvalidType fact is registered with different data type ErrFactInvalidType = errors.New("fact is registered with different data type") )
Functions ¶
func CalendarDateUTC ¶
func CalendarFullDateUTC ¶
Types ¶
type Boolean ¶
type Boolean = *booleanFact
Boolean data type used to declare user Facts. This is an alias to *booleanFact
func NewBoolean ¶
NewBoolean is the Boolean fact constructor
type Context ¶
type Context interface {
GetString(fact string) (String, error)
GetNumber(fact string) (Number, error)
GetFloat(fact string) (Float, error)
GetBoolean(fact string) (Boolean, error)
GetDate(fact string) (Date, error)
Get(fact string) (interface{}, bool)
GetObject(object string) (interface{}, bool)
ForEach(fn func(fact string, value interface{}))
Feedback(func(tx *Tx))
}
Context interface that can be accessed from onActivation function
type Date ¶
type Date = *dateFact
Date data type used to declare user Facts. This is an alias to *dateFact the data type is a wrapper of time.Time
type FactsContext ¶
type FactsContext interface {
WithMaxIterations(i int)
Register(object interface{}) error
RegisterString(object interface{}, attribute String) error
RegisterNumber(object interface{}, attribute Number) error
RegisterFloat(object interface{}, attribute Float) error
RegisterBoolean(object interface{}, attribute Boolean) error
RegisterDate(object interface{}, attribute Date) error
SetString(attribute interface{}, value string) error
SetNumber(attribute interface{}, value int64) error
SetFloat(attribute interface{}, value float64) error
SetBoolean(attribute interface{}, value bool) error
SetDate(attribute interface{}, value time.Time) error
Update(fn func(tx *Tx)) error
}
FactsContext interface that is returned when a Context is created from a ruleset
type Float ¶
type Float = *floatFact
Float data type used to declare user Facts. This is an alias to *floatFact
type Number ¶
type Number = *numberFact
Number data type used to declare user Facts. This is an alias to *numberFact
type Ruleset ¶
type Ruleset interface {
AddRule(r *_rule)
Context() *factContext
}
Ruleset interface to expose available actions to do with a ruleset
type String ¶
type String = *stringFact
String data type used to declare user Facts. This is an alias to *stringFact
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx transaction struct
func (*Tx) SetBoolean ¶
SetBoolean preset the given fact with the given bool value
Source Files
¶
- alpha.go
- api_builder.go
- api_builder_condition.go
- api_builder_condition_boolean.go
- api_builder_condition_date.go
- api_builder_condition_float.go
- api_builder_condition_number.go
- api_builder_condition_string.go
- api_builder_rule.go
- api_builder_ruleset.go
- api_context.go
- api_fact.go
- api_fact_boolean.go
- api_fact_date.go
- api_fact_float.go
- api_fact_number.go
- api_fact_string.go
- api_ruleset.go
- api_tx.go
- beta.go
- common.go
- condition.go
- condition_operator.go
- context.go
- defaults.go
- errors.go
- fact.go
- rule.go
- rule_operator.go
- ruleset.go
- tag.go
- term.go
- types.go
- utils.go