filter

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpEq      = Operator("=")
	OpNotEq   = Operator("!=")
	OpLt      = Operator("<")
	OpLte     = Operator("<=")
	OpGt      = Operator(">")
	OpGte     = Operator(">=")
	OpLike    = Operator("~")
	OpNotLike = Operator("!~")
	OpUnknown = Operator("")
)

Available operators to use in conditions

Variables

View Source
var (
	// ErrUnsupportedOperator represents case of using unsupported operator (app or type of value by path)
	ErrUnsupportedOperator = errors.New("unsupported operator")

	// ErrUnsupportedType represents case appearing unknown type of field value
	ErrUnsupportedType = errors.New("unsupported type")
)
View Source
var ErrInvalidOperator = errors.New("invalid operator")

ErrInvalidOperator appears when pass a string that doesn't match any known operator

Functions

func ProcessElem

func ProcessElem(condition Condition, elem []byte) (resElem []byte, isOk bool, err error)

ProcessElem solves accordance of stream element to condition

Types

type Condition

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

Condition is parsed string expression. It used to solve inclusion of stream elem

func NewConditionFromStr

func NewConditionFromStr(conditionStr string) (*Condition, error)

NewConditionFromStr builds condition object from string representation

func (Condition) Operator

func (c Condition) Operator() Operator

Operator returns operator of condition

func (Condition) Path

func (c Condition) Path() string

Path returns path to left operand of condition

func (Condition) Value

func (c Condition) Value() string

Value returns value (right operand of condition)

type Operator

type Operator string

Operator is part of condition expression that is used to compare two operands

func (Operator) String

func (o Operator) String() string

String casts operator to string

Jump to

Keyboard shortcuts

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