condition

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AndInStr = " AND "
	OrInStr  = " OR "
	AND      = "AND"
	OR       = "OR"
	NEGATIVE = "NOT"
)
View Source
const (
	ContainName     = "contain"
	ContainUsageMsg = "usage: contain(key, target)"
)
View Source
const (
	EqualName     = "equal"
	EqualUsageMsg = "usage: equal(key, target)"
)
View Source
const (
	ExistName     = "exist"
	ExistUsageMsg = "usage: exist(key)"
)
View Source
const (
	GreaterName     = "greater"
	GreaterUsageMsg = "usage: greater(key, value)"
)
View Source
const (
	HasPrefixName     = "hasPrefix"
	HasPrefixUsageMsg = "usage: hasPrefix(key, prefix)"
)
View Source
const (
	LessName     = "less"
	LessUsageMsg = "usage: less(key, value)"
)
View Source
const (
	MatchName     = "match"
	MatchUsageMsg = "usage: match(key, regex)"
)
View Source
const (
	OneOfName     = "oneOf"
	OneOfUsageMsg = "usage: oneOf(key, value1, value2...)"
)

Variables

This section is empty.

Functions

func RegisterCondition

func RegisterCondition(name string, f Factory)

Types

type Condition

type Condition interface {
	Check(e api.Event) bool
}

type Config

type Config struct {
	If   string          `yaml:"if,omitempty"`
	Then []action.Config `yaml:"then,omitempty"`
	Else []action.Config `yaml:"else,omitempty"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Contain

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

Contain check if the value of fields is Contain to target value

func NewContain

func NewContain(args []string) (*Contain, error)

func (*Contain) Check

func (c *Contain) Check(e api.Event) bool

type Equal

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

Equal check if the value of fields is equal to target value

func NewEqual

func NewEqual(args []string) (*Equal, error)

func (*Equal) Check

func (eq *Equal) Check(e api.Event) bool

type Exist

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

Exist check if the fields value is null or not exist in the event

func NewExist

func NewExist(args []string) (*Exist, error)

func (*Exist) Check

func (et *Exist) Check(e api.Event) bool

type Factory

type Factory func(args []string) (Condition, error)

type Greater

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

Greater check if the value of fields is Greater to target value

func NewGreater

func NewGreater(args []string) (*Greater, error)

func (*Greater) Check

func (gt *Greater) Check(e api.Event) bool

type HasPrefix

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

HasPrefix check if the value of fields has target prefix

func NewHasPrefix

func NewHasPrefix(args []string) (*HasPrefix, error)

func (*HasPrefix) Check

func (p *HasPrefix) Check(e api.Event) bool

type Instance

type Instance struct {
	Condition
	Negative bool
	Express  *expr.Expression
}

func GetConditions

func GetConditions(expression string) ([]*Instance, string, error)

GetConditions ..

type Less

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

Less check if the value of fields is Less to target value

func NewLess

func NewLess(args []string) (*Less, error)

func (*Less) Check

func (ls *Less) Check(e api.Event) bool

type Match

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

Match check whether the field value contains any match of the regular expression

func NewMatch

func NewMatch(args []string) (*Match, error)

func (*Match) Check

func (m *Match) Check(e api.Event) bool

type OneOf

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

OneOf check if the value of fields is one of these target values

func NewOneOf

func NewOneOf(args []string) (*OneOf, error)

func (*OneOf) Check

func (one *OneOf) Check(e api.Event) bool

Jump to

Keyboard shortcuts

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