package
0.0.0-20241230033226-a89011ae462a
Repository: https://github.com/2018yuli/rulego.git
Documentation: pkg.go.dev
# Functions
BuildMetadata 通过map,创建一个新的规则引擎消息元数据实例.
DefaultLogger returns a `Logger` implementation.
No description provided by the author
No description provided by the author
No description provided by the author
NewMetadata 创建一个新的规则引擎消息元数据实例1.
NewMsg 创建一个新的消息实例,并通过uuid生成消息ID.
WithComponentsRegistry is an option that sets the components registry of the Config.
No description provided by the author
No description provided by the author
No description provided by the author
WithJsMaxExecutionTime is an option that sets the js max execution time of the Config.
WithLogger is an option that sets the logger of the Config.
WithOnDebug is an option that sets the on debug callback of the Config.
WithOnEnd is an option that sets the on end callback of the Config.
WithParser is an option that sets the parser of the Config.
WithPool is an option that sets the pool of the Config.
# Constants
No description provided by the author
No description provided by the author
关系 节点与节点连接的关系,以下是常用的关系,可以自定义 relation types.
关系 节点与节点连接的关系,以下是常用的关系,可以自定义 relation types.
flow direction type 流向 消息流入、流出节点方向.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
flow direction type 流向 消息流入、流出节点方向.
关系 节点与节点连接的关系,以下是常用的关系,可以自定义 relation types.
No description provided by the author
关系 节点与节点连接的关系,以下是常用的关系,可以自定义 relation types.
# Variables
EmptyRuleNodeId 空节点ID.
# Structs
Config 规则引擎配置.
Metadata 规则引擎消息元数据.
RuleMsg 规则引擎消息.
RuleNodeId 组件ID类型定义.
RuleNodeRelation 节点与节点之间关系.
SafeComponentSlice 安全的组件列表切片.
# Interfaces
ComponentRegistry 节点组件注册器.
JsEngine JavaScript脚本引擎.
No description provided by the author
Node 规则引擎节点组件接口 把业务封或者常用工具装成组件,然后通过规则链配置方式调用该组件 实现方式参考`components`包 然后注册到`RuleGo`默认注册器 rulego.Registry.Register(&MyNode{}).
NodeCtx 规则节点实例化上下文.
Parser 规则链定义文件DSL解析器 默认使用json方式,如果使用其他方式定义规则链,可以实现该接口 然后通过该方式注册到规则引擎中:`rulego.NewConfig(WithParser(&MyParser{})`.
PluginRegistry go plugin 方式提供节点组件接口 示例: package main var Plugins MyPlugins// plugin entry point type MyPlugins struct{}
func (p *MyPlugins) Init() error { return nil }
func (p *MyPlugins) Components() []types.Node { return []types.Node{&UpperNode{}, &TimeNode{}, &FilterNode{}}//一个插件可以提供多个组件 }
go build -buildmode=plugin -o plugin.so plugin.go # 编译插件,生成plugin.so文件 rulego.Registry.RegisterPlugin("test", "./plugin.so")//注册到RuleGo默认注册器9.
Pool 协程池.
RuleContext 规则引擎消息处理上下文接口 处理把消息流转到下一个或者多个节点逻辑 根据规则链连接关系查找当前节点的下一个或者多个节点,然后调用对应节点:nextNode.OnMsg(ctx, msg)触发下一个节点的业务逻辑 另外处理节点OnDebug和OnEnd回调逻辑.
# Type aliases
ComponentType 组件类型:规则节点或者子规则链.
Configuration 组件配置类型.
DataType 消息数据类型.
Option is a function type that modifies the Config.
RuleContextOption 修改RuleContext选项的函数.