builder

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// BuilderLog is a logger instance twith default fields for grule
	BuilderLog = logger.Log.WithFields(builderLogFields)
)

Functions

func SetLogger

func SetLogger(log interface{})

SetLogger changes default logger on external

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

Jump to

Keyboard shortcuts

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