rule

package
v0.0.0-...-2b55ecc Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	EventType string `json:"event_type,omitempty"`
	Name      string `json:"name,omitempty"`
}

type Actions

type Actions []Action

type Body

type Body struct {
	Actions    Actions    `json:"actions,omitempty"`
	Expression Expression `json:"expression,omitempty"`
}

type Builder

type Builder struct {
	strings.Builder
	Group bool
	Paths map[string][]string
	Cache [][]string
	Names []string
}

func (*Builder) Contains

func (b *Builder) Contains(e string) bool

func (*Builder) Count

func (b *Builder) Count(p []string) int

func (*Builder) Print

func (b *Builder) Print(format string, a ...interface{}) (int, error)

func (*Builder) Variable

func (b *Builder) Variable(e, f string) string

type Condition

type Condition func(j interface{}) (interface{}, error)

func (Condition) Evaluate

func (c Condition) Evaluate(j interface{}) (interface{}, error)

type ExitPoints

type ExitPoints struct {
	IsEveryCondition bool   `json:"is_every_condition,omitempty"`
	Points           Points `json:"points,omitempty"`
}

type Expression

type Expression []Operation

func (Expression) Build

func (e Expression) Build(events []string) (string, map[string][]string, error)

type Operand

type Operand struct {
	Type  string `json:"type,omitempty"`
	Value string `json:"value,omitempty"`
	Event string `json:"event,omitempty"`
	Field string `json:"field,omitempty"`
}

func (Operand) Print

func (o Operand) Print(b *Builder) (err error)

type Operation

type Operation struct {
	Group    bool    `json:"group,omitempty"`
	Left     Operand `json:"left"`
	Action   string  `json:"action,omitempty"`
	Right    Operand `json:"right"`
	Operator string  `json:"operator,omitempty"`
}

func (Operation) Print

func (o Operation) Print(b *Builder) (err error)

type Point

type Point struct {
	Token string `json:"token,omitempty"`
	Type  string `json:"type,omitempty"`
}

type Points

type Points []Point

type Rule

type Rule struct {
	BasicEvents      []string   `json:"basic_events,omitempty"`
	Body             Body       `json:"body"`
	CreatedDate      time.Time  `json:"created_date"`
	Creator          string     `json:"creator,omitempty"`
	Description      string     `json:"description,omitempty"`
	ExitPoints       ExitPoints `json:"exit_points"`
	Id               string     `json:"id,omitempty"`
	Initiator        string     `json:"initiator,omitempty"`
	KeyField         string     `json:"key_field,omitempty"`
	ModificationDate time.Time  `json:"modification_date"`
	Name             string     `json:"name,omitempty"`
	Status           string     `json:"status,omitempty"`
	Type             string     `json:"type,omitempty"`
	Weight           int        `json:"weight,omitempty"`
}

func (Rule) Condition

func (r Rule) Condition() (Condition, error)

Jump to

Keyboard shortcuts

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