condition

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

View Source
const (
	GroupLogicAnd = iota
	GroupLogicOr
	GroupLogicXor
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder interface {

	// Not makes a resulting Condition negative.
	// May be set for any resulting Condition type.
	Not() Builder

	// All defines the nested Condition set for a resulting GroupCondition with GroupLogicAnd.
	All(children []Condition) Builder

	// Any defines the nested Condition set for a resulting GroupCondition with GroupLogicOr.
	Any(children []Condition) Builder

	// Xor defines the nested Condition set for a resulting GroupCondition with GroupLogicXor.
	Xor(children []Condition) Builder

	// BuildGroupCondition builds a GroupCondition.
	BuildGroupCondition() (c Condition)

	// AttributeKey defines the incoming messages attribute key to match for a resulting KeyCondition.
	// Default is empty string key. For a TextCondition empty key causes the matching against all attribute keys.
	AttributeKey(k string) Builder

	// AnyOfWords defines the text search words (separated by a whitespace) for a resulting TextCondition.
	AnyOfWords(text string) Builder

	// TextEquals enables the exact text matching criteria for a resulting TextCondition.
	TextEquals(text string) Builder

	// BuildTextCondition builds a TextCondition.
	BuildTextCondition() (c Condition)

	// GreaterThan enables the number value matching criteria "x > val" for a NumberCondition.
	GreaterThan(val float64) Builder

	// GreaterThanOrEqual enables the number value matching criteria "x >= val" for a NumberCondition.
	GreaterThanOrEqual(val float64) Builder

	// Equal enables the number value matching criteria "x == val" for a NumberCondition.
	Equal(val float64) Builder

	// LessThanOrEqual enables the number value matching criteria "x <= val" for a NumberCondition.
	LessThanOrEqual(val float64) Builder

	// LessThan enables the number value matching criteria "x < val" for a NumberCondition.
	LessThan(val float64) Builder

	// BuildNumberCondition builds a NumberCondition
	BuildNumberCondition() (c Condition)
}

func NewBuilder

func NewBuilder() Builder

type Condition

type Condition interface {
	IsNot() bool
}

func NewCondition

func NewCondition(not bool) Condition

type GroupCondition

type GroupCondition interface {
	Condition
	GetLogic() (logic GroupLogic)
	GetGroup() (group []Condition)
}

func NewGroupCondition

func NewGroupCondition(c Condition, logic GroupLogic, group []Condition) GroupCondition

type GroupLogic

type GroupLogic int

func (GroupLogic) String

func (gl GroupLogic) String() string

type KeyCondition

type KeyCondition interface {
	Condition
	GetKey() string
}

func NewKeyCondition

func NewKeyCondition(c Condition, k string) KeyCondition

type NumOp added in v1.0.4

type NumOp int
const (
	NumOpUndefined NumOp = iota
	NumOpGt
	NumOpGte
	NumOpEq
	NumOpLte
	NumOpLt
)

func (NumOp) String added in v1.0.4

func (op NumOp) String() string

type NumberCondition added in v1.0.4

type NumberCondition interface {
	KeyCondition
	GetOperation() NumOp
	GetValue() float64
}

func NewNumberCondition added in v1.0.4

func NewNumberCondition(kc KeyCondition, op NumOp, val float64) NumberCondition

type TextCondition added in v0.0.5

type TextCondition interface {
	KeyCondition
	GetTerm() string
	IsExact() bool
}

func NewTextCondition added in v0.0.5

func NewTextCondition(kc KeyCondition, pattern string, exact bool) TextCondition

Jump to

Keyboard shortcuts

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