rule_manager

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 4 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) GetDestinationSchema added in v0.0.16

func (e *Handler) GetDestinationSchema() *schemer.Schema

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
	// contains filtered or unexported fields
}

func NewRule

func NewRule(rule *product_sdk.Rule) *Rule

func (*Rule) Transform added in v0.0.16

func (r *Rule) Transform(env map[string]interface{}, data map[string]interface{}) ([]map[string]interface{}, error)

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