adapter

package
v4.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultLogicalOperator = LogicalOperatorAnd

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparison

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

func NewComparisonOperator

func NewComparisonOperator(t ComparisonOperator, v interface{}) *Comparison

func NewCustomComparisonOperator

func NewCustomComparisonOperator(op string, v interface{}) *Comparison

func (*Comparison) CustomOperator

func (c *Comparison) CustomOperator() string

func (*Comparison) Operator

func (c *Comparison) Operator() ComparisonOperator

func (*Comparison) Value

func (c *Comparison) Value() interface{}

type ComparisonOperator

type ComparisonOperator uint8

ComparisonOperator is the base type for comparison operators.

const (
	ComparisonOperatorNone ComparisonOperator = iota
	ComparisonOperatorCustom

	ComparisonOperatorEqual
	ComparisonOperatorNotEqual

	ComparisonOperatorLessThan
	ComparisonOperatorGreaterThan

	ComparisonOperatorLessThanOrEqualTo
	ComparisonOperatorGreaterThanOrEqualTo

	ComparisonOperatorBetween
	ComparisonOperatorNotBetween

	ComparisonOperatorIn
	ComparisonOperatorNotIn

	ComparisonOperatorIs
	ComparisonOperatorIsNot

	ComparisonOperatorLike
	ComparisonOperatorNotLike

	ComparisonOperatorRegExp
	ComparisonOperatorNotRegExp
)

Comparison operators

type Constraint

type Constraint interface {
	// Key is the leftmost part of the constraint and usually contains a column
	// name.
	Key() interface{}

	// Value if the rightmost part of the constraint and usually contains a
	// column value.
	Value() interface{}
}

Constraint interface represents a single condition, like "a = 1". where `a` is the key and `1` is the value. This is an exported interface but it's rarely used directly, you may want to use the `db.Cond{}` map instead.

func NewConstraint

func NewConstraint(key interface{}, value interface{}) Constraint

NewConstraint creates a constraint.

type ConstraintValuer added in v4.1.0

type ConstraintValuer interface {
	ConstraintValue() interface{}
}

ConstraintValuer allows constraints to use specific values of their own.

type Constraints

type Constraints interface {
	// Constraints returns an array of constraints.
	Constraints() []Constraint
}

Constraints interface represents an array of constraints, like "a = 1, b = 2, c = 3".

type FuncExpr

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

func NewFuncExpr

func NewFuncExpr(name string, args []interface{}) *FuncExpr

func (*FuncExpr) Arguments

func (f *FuncExpr) Arguments() []interface{}

func (*FuncExpr) Name

func (f *FuncExpr) Name() string

type LogicalExpr

type LogicalExpr interface {
	// Expressions returns child sentences.
	Expressions() []LogicalExpr

	// Operator returns the Operator that joins all the sentences in the group.
	Operator() LogicalOperator

	// Empty returns true if the compound has zero children, false otherwise.
	Empty() bool
}

LogicalExpr represents a group formed by one or more sentences joined by an Operator like "AND" or "OR".

type LogicalExprGroup

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

func NewLogicalExprGroup

func NewLogicalExprGroup(op LogicalOperator, conds ...LogicalExpr) *LogicalExprGroup

func (*LogicalExprGroup) Base

func (g *LogicalExprGroup) Base() interface{}

func (*LogicalExprGroup) Empty

func (g *LogicalExprGroup) Empty() bool

Empty returns true if this condition has no elements. False otherwise.

func (*LogicalExprGroup) Expressions

func (g *LogicalExprGroup) Expressions() []LogicalExpr

Expressions returns each one of the conditions as a compound.

func (*LogicalExprGroup) Fn

func (g *LogicalExprGroup) Fn(in interface{}) error

func (*LogicalExprGroup) Frame

func (g *LogicalExprGroup) Frame(fn func(*[]LogicalExpr) error) *LogicalExprGroup

func (*LogicalExprGroup) Operator

func (g *LogicalExprGroup) Operator() LogicalOperator

Operator is undefined for a logical group.

func (*LogicalExprGroup) Prev

type LogicalOperator

type LogicalOperator uint

LogicalOperator represents the operation on a compound statement.

const (
	LogicalOperatorNone LogicalOperator = iota
	LogicalOperatorAnd
	LogicalOperatorOr
)

LogicalExpr Operators.

type RawExpr

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

RawExpr interface represents values that can bypass SQL filters. This is an exported interface but it's rarely used directly, you may want to use the `db.Raw()` function instead.

func NewRawExpr

func NewRawExpr(value string, args []interface{}) *RawExpr

func (*RawExpr) Arguments

func (r *RawExpr) Arguments() []interface{}

func (*RawExpr) Empty

func (r *RawExpr) Empty() bool

Empty return false if this struct has no value.

func (*RawExpr) Expressions

func (r *RawExpr) Expressions() []LogicalExpr

Expressions returns a logical expressio.n

func (RawExpr) Operator

func (r RawExpr) Operator() LogicalOperator

Operator returns the default compound operator.

func (RawExpr) Raw

func (r RawExpr) Raw() string

func (RawExpr) String

func (r RawExpr) String() string

Jump to

Keyboard shortcuts

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