rules

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const EndpointDirName = "endpoints"

Variables

This section is empty.

Functions

func InitEndpoint

func InitEndpoint() error

func InitEngine

func InitEngine() error

func NewConfig

func NewConfig() (types.Config, error)

func RegisterFunctions

func RegisterFunctions()

Types

type Aspect

type Aspect struct{}

func (*Aspect) New

func (a *Aspect) New() types.Aspect

func (*Aspect) Order

func (a *Aspect) Order() int

func (*Aspect) PointCut

func (a *Aspect) PointCut(_ types.RuleContext, _ types.RuleMsg, _ string) bool

func (*Aspect) Start

func (a *Aspect) Start(_ types.RuleContext, msg types.RuleMsg) (types.RuleMsg, error)

func (*Aspect) Type

func (a *Aspect) Type() string

type DslParser

type DslParser struct{}

func (*DslParser) DecodeRuleChain

func (p *DslParser) DecodeRuleChain(rootRuleChain []byte) (types.RuleChain, error)

func (*DslParser) DecodeRuleNode

func (p *DslParser) DecodeRuleNode(rootRuleChain []byte) (types.RuleNode, error)

func (*DslParser) EncodeRuleChain

func (p *DslParser) EncodeRuleChain(def interface{}) ([]byte, error)

func (*DslParser) EncodeRuleNode

func (p *DslParser) EncodeRuleNode(def interface{}) ([]byte, error)

type Edge

type Edge struct {
	From string
	To   string
	Type string
}

type JsonParser

type JsonParser struct{}

func (*JsonParser) DecodeRuleChain

func (p *JsonParser) DecodeRuleChain(rootRuleChain []byte) (types.RuleChain, error)

func (*JsonParser) DecodeRuleNode

func (p *JsonParser) DecodeRuleNode(rootRuleChain []byte) (types.RuleNode, error)

func (*JsonParser) EncodeRuleChain

func (p *JsonParser) EncodeRuleChain(def interface{}) ([]byte, error)

func (*JsonParser) EncodeRuleNode

func (p *JsonParser) EncodeRuleNode(def interface{}) ([]byte, error)

type RuleChain

type RuleChain struct {

	// ID is the unique identifier of the rule chain.
	ID string `json:"id" yaml:"id"`
	// Name is the name of the rule chain.
	Name string `json:"name" yaml:"name"`
	// DebugMode indicates whether the node is in debug mode. If true, a debug callback function is triggered when the node processes messages.
	// This setting overrides the `DebugMode` configuration of the node.
	DebugMode bool `json:"debugMode" yaml:"debugMode"`
	// Root indicates whether this rule chain is a root or a sub-rule chain. (Used only as a marker, not applied in actual logic)
	Root bool `json:"root" yaml:"root"`
	// Disabled indicates whether the rule chain is disabled.
	Disabled bool `json:"disabled" yaml:"disabled"`
	// Configuration contains the configuration information of the rule chain.
	Configuration types.Configuration `json:"configuration,omitempty" yaml:"configuration"`
	// AdditionalInfo is an extension field.
	AdditionalInfo map[string]interface{} `json:"additionalInfo,omitempty" yaml:"additionalInfo"`

	// FirstNodeIndex is the index of the first node in data flow, default is 0.
	FirstNodeIndex int `json:"firstNodeIndex" yaml:"firstNodeIndex"`
	// Nodes are the component definitions of the nodes.
	Endpoints []*types.EndpointDsl `json:"endpoints,omitempty" yaml:"endpoints"`
	// Nodes are the component definitions of the nodes.
	// Each object represents a rule node within the rule chain.
	Nodes []*types.RuleNode `json:"nodes" yaml:"nodes"`
	// Connections define the connections between two nodes in the rule chain.
	Connections []types.NodeConnection `json:"connections" yaml:"connections"`
	// Deprecated: Use Flow Node instead.
	// RuleChainConnections are the connections between a node and a sub-rule chain.
	RuleChainConnections []types.RuleChainConnection `json:"ruleChainConnections,omitempty" yaml:"ruleChainConnections"`

	// Custom fields
	// Pipelines is node pipelines, if set pipelines will be used, otherwise will use connections
	Pipelines []string `json:"pipelines" yaml:"pipelines"`
}

RuleChain defines a rule chain.

type YamlParser

type YamlParser struct{}

func (*YamlParser) DecodeRuleChain

func (p *YamlParser) DecodeRuleChain(rootRuleChain []byte) (types.RuleChain, error)

func (*YamlParser) DecodeRuleNode

func (p *YamlParser) DecodeRuleNode(rootRuleChain []byte) (types.RuleNode, error)

func (*YamlParser) EncodeRuleChain

func (p *YamlParser) EncodeRuleChain(def interface{}) ([]byte, error)

func (*YamlParser) EncodeRuleNode

func (p *YamlParser) EncodeRuleNode(def interface{}) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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