Documentation ¶
Index ¶
- Variables
- func SetLogger(log interface{})
- type RuleBuilder
- func (builder *RuleBuilder) BuildRuleFromResource(name, version string, resource pkg.Resource) error
- func (builder *RuleBuilder) BuildRuleFromResources(name, version string, resource []pkg.Resource) error
- func (builder *RuleBuilder) BuildRulesFromBundle(name, version string, bundle pkg.ResourceBundle) error
- func (builder *RuleBuilder) MustBuildRuleFromResource(name, version string, resource pkg.Resource)
- func (builder *RuleBuilder) MustBuildRuleFromResources(name, version string, resource []pkg.Resource)
- func (builder *RuleBuilder) MustBuildRulesFromBundle(name, version string, bundle pkg.ResourceBundle)
Constants ¶
This section is empty.
Variables ¶
var ( // BuilderLog is a logger instance twith default fields for grule BuilderLog = logger.Log.WithFields(builderLogFields) )
Functions ¶
Types ¶
type RuleBuilder ¶
type RuleBuilder struct {
KnowledgeLibrary *ast.KnowledgeLibrary
}
RuleBuilder builds rule from GRL script into contained KnowledgeBase
func NewRuleBuilder ¶
func NewRuleBuilder(KnowledgeLibrary *ast.KnowledgeLibrary) *RuleBuilder
NewRuleBuilder creates new RuleBuilder instance. This builder will add all loaded rules into the specified knowledgebase.
func (*RuleBuilder) BuildRuleFromResource ¶
func (builder *RuleBuilder) BuildRuleFromResource(name, version string, resource pkg.Resource) error
BuildRuleFromResource will load rules from a single resource. It will return an error if it encounter an error on the specified resource.
func (*RuleBuilder) BuildRuleFromResources ¶
func (builder *RuleBuilder) BuildRuleFromResources(name, version string, resource []pkg.Resource) error
BuildRuleFromResources will load rules from multiple resources. It will return an error if it encounter an error on the first script it found.
func (*RuleBuilder) BuildRulesFromBundle ¶
func (builder *RuleBuilder) BuildRulesFromBundle(name, version string, bundle pkg.ResourceBundle) error
BuildRulesFromBundle will load rules from a bundle into knowledge base.
func (*RuleBuilder) MustBuildRuleFromResource ¶
func (builder *RuleBuilder) MustBuildRuleFromResource(name, version string, resource pkg.Resource)
MustBuildRuleFromResource is similar to BuildRuleFromResource, with the difference is, it will panic if rule script contains error.
func (*RuleBuilder) MustBuildRuleFromResources ¶
func (builder *RuleBuilder) MustBuildRuleFromResources(name, version string, resource []pkg.Resource)
MustBuildRuleFromResources is similar to BuildRuleFromResources, with the difference is, it will panic if rule script contains error.
func (*RuleBuilder) MustBuildRulesFromBundle ¶
func (builder *RuleBuilder) MustBuildRulesFromBundle(name, version string, bundle pkg.ResourceBundle)
MustBuildRulesFromBundle is the same with BuildRulesFromBundle but it will panic if any error arises during loading resource and inserting it to knowledgebase