Documentation
¶
Index ¶
- Constants
- type Comparison
- type ComparisonOperator
- type Constraint
- type ConstraintValuer
- type Constraints
- type FuncExpr
- type LogicalExpr
- type LogicalExprGroup
- func (g *LogicalExprGroup) Base() interface{}
- func (g *LogicalExprGroup) Empty() bool
- func (g *LogicalExprGroup) Expressions() []LogicalExpr
- func (g *LogicalExprGroup) Fn(in interface{}) error
- func (g *LogicalExprGroup) Frame(fn func(*[]LogicalExpr) error) *LogicalExprGroup
- func (g *LogicalExprGroup) Operator() LogicalOperator
- func (g *LogicalExprGroup) Prev() immutable.Immutable
- type LogicalOperator
- type RawExpr
Constants ¶
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 ¶
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 ¶
func (g *LogicalExprGroup) Prev() immutable.Immutable
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 (*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.