rule_manager

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandlerTypes = map[string]HandlerType{
	"script": HANDLER_SCRIPT,
}

Functions

This section is empty.

Types

type EventManager

type EventManager struct {
	// contains filtered or unexported fields
}

func NewEventManager

func NewEventManager() *EventManager

func (*EventManager) AddRule

func (em *EventManager) AddRule(eventName string, rule *Rule)

func (*EventManager) DeleteRule

func (em *EventManager) DeleteRule(eventName string, ruleID string)

func (*EventManager) GetEvents

func (em *EventManager) GetEvents() []string

func (*EventManager) GetRuleSet

func (em *EventManager) GetRuleSet(eventName string) *RuleSet

type Handler

type Handler struct {
	Type        HandlerType
	Script      string
	Transformer *schemer.Transformer
}

func NewHandler

func NewHandler(config *product_sdk.HandlerConfig, sourceSchema *schemer.Schema, targetSchema *schemer.Schema) *Handler

func (*Handler) Run

func (e *Handler) Run(env map[string]interface{}, data map[string]interface{}) ([]map[string]interface{}, error)

type HandlerType

type HandlerType int32
const (
	HANDLER_SCRIPT HandlerType = iota
)

type Rule

type Rule struct {
	product_sdk.Rule
	Handler      *Handler
	Schema       *schemer.Schema
	TargetSchema *schemer.Schema
}

func NewRule

func NewRule(rule *product_sdk.Rule) *Rule

type RuleManager

type RuleManager struct {
	// contains filtered or unexported fields
}

func NewRuleManager

func NewRuleManager() *RuleManager

func (*RuleManager) AddRule

func (rm *RuleManager) AddRule(rule *Rule) error

func (*RuleManager) DeleteRule

func (rm *RuleManager) DeleteRule(id string)

func (*RuleManager) GetEvents

func (rm *RuleManager) GetEvents() []string

func (*RuleManager) GetRule

func (rm *RuleManager) GetRule(id string) *Rule

func (*RuleManager) GetRules

func (rm *RuleManager) GetRules() []*Rule

func (*RuleManager) GetRulesByEvent

func (rm *RuleManager) GetRulesByEvent(eventName string) []*Rule

type RuleSet

type RuleSet struct {
	// contains filtered or unexported fields
}

func NewRuleSet

func NewRuleSet() *RuleSet

func (*RuleSet) Delete

func (rm *RuleSet) Delete(id string)

func (*RuleSet) Get

func (rm *RuleSet) Get(id string) *Rule

func (*RuleSet) List

func (rm *RuleSet) List() []*Rule

func (*RuleSet) Set

func (rm *RuleSet) Set(id string, rule *Rule)

Jump to

Keyboard shortcuts

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