Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
type Rule struct { Operation string `json:"operation"` LeftSide string `json:"left_side"` RightSide string `json:"right_side"` }
Rule represents a single rule
type RuleGraph ¶
type RuleGraph struct {
// contains filtered or unexported fields
}
RuleGraph represents the graph of rules to evaluate
func NewRuleGraph ¶
func NewRuleGraph() *RuleGraph
NewRuleGraph returns a new RuleGraph instance without any set of rules
func NewRuleGraphWith ¶
NewRuleGraphWith returns a new RuleGraph instance with a predefined ruleset
func (*RuleGraph) Evaluate ¶
Evaluate runs all the graph rules against the input and returns a list of rule IDs that evaluated as true against the provided input
func (RuleGraph) IsRulesetEmpty ¶
IsRulesetEmpty returns true if the rule set of the instance is empty
func (*RuleGraph) LoadRulesFromString ¶
LoadRulesFromString replaces the current rules with rules encoded as a string, or return an error if the input is malformed
type RulesNode ¶
type RulesNode struct { ID uuid.UUID `json:"id"` Rules []Rule `json:"rules"` SkipProbability float32 `json:"skip_probability"` }
RulesNode represents node with rules
func NewRulesNode ¶ added in v1.2.0
NewRulesNode returns a new rules node given the explicit set of params as input (rules as a encoding string)
func RulesFromString ¶
RulesFromString returns a new set of rules from a string or an error, if the string is malformed