builder

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: Apache-2.0 Imports: 2 Imported by: 36

Documentation

Overview

Package builder is used to construct predicate expressions using builder functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AndExpr

type AndExpr struct {
	// Left is a left argument of && operator expression
	Left Expr
	// Right is a right argument of && operator expression
	Right Expr
}

AndExpr returns && expression.

func And

func And(left, right Expr) AndExpr

And returns && expression.

func (AndExpr) String

func (a AndExpr) String() string

String returns expression text used in rules.

type ContainsExpr

type ContainsExpr struct {
	// Left is a left argument of Contains expression
	Left Expr
	// Right is a right argument of Contains expression
	Right Expr
}

ContainsExpr constructs function expression used in rules specifications that checks if one value contains the other, e.g. contains([]string{"a"}, "b") where left is []string{"a"} and right is "b".

func Contains

func Contains(a, b Expr) ContainsExpr

Contains returns contains function call expression.

func (ContainsExpr) String

func (i ContainsExpr) String() string

String returns function call expression used in rules.

type EqualsExpr

type EqualsExpr struct {
	// Left is a left argument of Equals expression
	Left Expr
	// Value to check
	Right Expr
}

EqualsExpr constructs function expression used in rules specifications that checks if one value is equal to another e.g. equals("a", "b") where Left is "a" and right is "b".

func Equals

func Equals(left, right Expr) EqualsExpr

Equals returns equals expression.

func (EqualsExpr) String

func (i EqualsExpr) String() string

String returns function call expression used in rules.

type Expr

type Expr interface {
	// String serializes expression into format parsed by rules engine
	// (golang based syntax)
	String() string
}

Expr is an expression builder, used to create expressions in rules definitions.

type IdentifierExpr

type IdentifierExpr string

IdentifierExpr is identifier expression.

func Identifier

func Identifier(v string) IdentifierExpr

Identifier returns identifier expression.

func (IdentifierExpr) String

func (i IdentifierExpr) String() string

String serializes identifier expression into format parsed by rules engine.

type NotExpr

type NotExpr struct {
	// Expr is an expression to negate
	Expr Expr
}

NotExpr constructs function expression used in rules specifications that negates the result of the boolean predicate e.g. ! equals"a", "b") where Left is "a" and right is "b".

func Not

func Not(expr Expr) NotExpr

Not returns ! expression.

func (NotExpr) String

func (n NotExpr) String() string

String returns function call expression used in rules.

type OrExpr

type OrExpr struct {
	// Left is a left argument of || operator expression
	Left Expr
	// Right is a right argument of || operator expression
	Right Expr
}

OrExpr returns || expression.

func Or

func Or(left, right Expr) OrExpr

Or returns || expression.

func (OrExpr) String

func (a OrExpr) String() string

String returns expression text used in rules.

type StringExpr

type StringExpr string

StringExpr is a string expression.

func String

func String(v string) StringExpr

String returns string expression.

func (StringExpr) String

func (s StringExpr) String() string

type StringsExpr

type StringsExpr []string

StringsExpr is a slice of strings.

func (StringsExpr) String

func (s StringsExpr) String() string

Jump to

Keyboard shortcuts

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