predicates

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteAll

func WriteAll(sw io.StringWriter, predicates []Predicate) error

WriteAll writes predicates to a string writer. It will ignore the logic operator of the first predicate.

Types

type Between

type Between struct {
	Col   expressions.Expression
	Low   expressions.Expression
	High  expressions.Expression
	Logic Logic
}

func (Between) LogicOp

func (f Between) LogicOp() Logic

func (Between) WriteTo

func (f Between) WriteTo(writer io.StringWriter) error

type EQ

type EQ struct {
	Col   expressions.Expression
	Expr  expressions.Expression
	Logic Logic
}

EQ is an equal condition.

func (EQ) LogicOp

func (f EQ) LogicOp() Logic

func (EQ) WriteTo

func (f EQ) WriteTo(writer io.StringWriter) error

type GT

type GT struct {
	Col   expressions.Expression
	Expr  expressions.Expression
	Logic Logic
}

GT is a greater than condition.

func (GT) LogicOp

func (f GT) LogicOp() Logic

func (GT) WriteTo

func (f GT) WriteTo(writer io.StringWriter) error

type GTE

type GTE struct {
	Col   expressions.Expression
	Expr  expressions.Expression
	Logic Logic
}

GTE is a greater than or equal to condition.

func (GTE) LogicOp

func (f GTE) LogicOp() Logic

func (GTE) WriteTo

func (f GTE) WriteTo(writer io.StringWriter) error

type In

type In struct {
	Col         expressions.Expression
	Expressions []expressions.Expression
	Logic       Logic
}

In is an IN condition.

func (In) LogicOp

func (f In) LogicOp() Logic

func (In) WriteTo

func (f In) WriteTo(writer io.StringWriter) error

type IsNull

type IsNull struct {
	Col   expressions.Expression
	Logic Logic
}

IsNull is a IS NULL condition.

func (IsNull) LogicOp

func (f IsNull) LogicOp() Logic

func (IsNull) WriteTo

func (f IsNull) WriteTo(writer io.StringWriter) error

type LT

type LT struct {
	Col   expressions.Expression
	Expr  expressions.Expression
	Logic Logic
}

LT is a less than condition.

func (LT) LogicOp

func (f LT) LogicOp() Logic

func (LT) WriteTo

func (f LT) WriteTo(writer io.StringWriter) error

type LTE

type LTE struct {
	Col   expressions.Expression
	Expr  expressions.Expression
	Logic Logic
}

LTE is a less than or equal to condition.

func (LTE) LogicOp

func (f LTE) LogicOp() Logic

func (LTE) WriteTo

func (f LTE) WriteTo(writer io.StringWriter) error

type Like

type Like struct {
	Col   expressions.Expression
	Expr  expressions.Expression
	Logic Logic
}

Like is a LIKE condition.

func (Like) LogicOp

func (f Like) LogicOp() Logic

func (Like) WriteTo

func (f Like) WriteTo(writer io.StringWriter) error

type Logic

type Logic int

Logic is a logic operator.

const (
	AND Logic = iota // LogicAnd is the AND operator.
	OR               // LogicOr is the OR operator.
)

type NE

type NE struct {
	Col   expressions.Expression
	Expr  expressions.Expression
	Logic Logic
}

NE is a not equal condition.

func (NE) LogicOp

func (f NE) LogicOp() Logic

func (NE) WriteTo

func (f NE) WriteTo(writer io.StringWriter) error

type Not

type Not struct {
	Predicate Predicate
}

Not is a NOT condition.

func (Not) LogicOp

func (f Not) LogicOp() Logic

func (Not) WriteTo

func (f Not) WriteTo(writer io.StringWriter) error

type Predicate

type Predicate interface {
	LogicOp() Logic // LogicOp returns the logic operator: AND or OR.
	WriteTo(writer io.StringWriter) error
}

Predicates are conditions that can be evaluated to SQL three-valued logic (3VL) (true/false/unknown)

type Wrap

type Wrap struct {
	Predicates []Predicate
	Logic      Logic
}

Wrap wraps a group of predicates in parenthesis.

func (Wrap) LogicOp

func (f Wrap) LogicOp() Logic

func (Wrap) WriteTo

func (f Wrap) WriteTo(sw io.StringWriter) error

Write writes the group to the given writer.

Jump to

Keyboard shortcuts

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