expr

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BetweenExpr

type BetweenExpr struct {
	Column string
	Start  interface{}
	End    interface{}
	Not    bool
}

BetweenExpr represents BETWEEN operations

func (*BetweenExpr) ToSQL

func (b *BetweenExpr) ToSQL() (string, []interface{})

type BinaryExpr

type BinaryExpr struct {
	Left     string
	Operator string
	Right    interface{}
}

BinaryExpr represents a binary operation (=, !=, <, >, etc.)

func (*BinaryExpr) ToSQL

func (b *BinaryExpr) ToSQL() (string, []interface{})

type Expr

type Expr interface {
	// ToSQL converts the expression to SQL with placeholders
	ToSQL() (string, []interface{})
}

Expr represents a SQL expression (WHERE, HAVING, etc.)

func And

func And(exprs ...Expr) Expr

And combines multiple expressions with AND

func Between

func Between[T any](col *table.Column[T], start, end T) Expr

Between creates a BETWEEN expression

func Eq

func Eq[T any](col *table.Column[T], value T) Expr

Eq creates an equality expression (column = value)

func Ge

func Ge[T any](col *table.Column[T], value T) Expr

Ge creates a greater-than-or-equal expression (column >= value)

func Gt

func Gt[T any](col *table.Column[T], value T) Expr

Gt creates a greater-than expression (column > value)

func ILike

func ILike(col *table.Column[string], pattern string) Expr

ILike creates an ILIKE expression (case-insensitive)

func In

func In[T any](col *table.Column[T], values ...T) Expr

In creates an IN expression (column IN (values...))

func IsNotNull

func IsNotNull[T any](col *table.Column[T]) Expr

IsNotNull creates an IS NOT NULL expression

func IsNull

func IsNull[T any](col *table.Column[T]) Expr

IsNull creates an IS NULL expression

func Le

func Le[T any](col *table.Column[T], value T) Expr

Le creates a less-than-or-equal expression (column <= value)

func Like

func Like(col *table.Column[string], pattern string) Expr

Like creates a LIKE expression

func Lt

func Lt[T any](col *table.Column[T], value T) Expr

Lt creates a less-than expression (column < value)

func Ne

func Ne[T any](col *table.Column[T], value T) Expr

Ne creates a not-equal expression (column != value)

func NotBetween

func NotBetween[T any](col *table.Column[T], start, end T) Expr

NotBetween creates a NOT BETWEEN expression

func NotIn

func NotIn[T any](col *table.Column[T], values ...T) Expr

NotIn creates a NOT IN expression

func NotLike

func NotLike(col *table.Column[string], pattern string) Expr

NotLike creates a NOT LIKE expression

func Or

func Or(exprs ...Expr) Expr

Or combines multiple expressions with OR

func Raw

func Raw(sql string, args ...interface{}) Expr

Raw creates a raw SQL expression

type InExpr

type InExpr struct {
	Column string
	Values []interface{}
	Not    bool
}

InExpr represents IN/NOT IN operations

func (*InExpr) ToSQL

func (i *InExpr) ToSQL() (string, []interface{})

type LikeExpr

type LikeExpr struct {
	Column          string
	Pattern         string
	CaseInsensitive bool
	Not             bool
}

LikeExpr represents LIKE/ILIKE operations

func (*LikeExpr) ToSQL

func (l *LikeExpr) ToSQL() (string, []interface{})

type LogicalExpr

type LogicalExpr struct {
	Operator string // "AND" or "OR"
	Exprs    []Expr
}

LogicalExpr represents AND/OR combinations

func (*LogicalExpr) ToSQL

func (l *LogicalExpr) ToSQL() (string, []interface{})

type RawExpr

type RawExpr struct {
	SQL  string
	Args []interface{}
}

RawExpr represents a raw SQL expression

func (*RawExpr) ToSQL

func (r *RawExpr) ToSQL() (string, []interface{})

type UnaryExpr

type UnaryExpr struct {
	Column   string
	Operator string
}

UnaryExpr represents unary operations (IS NULL, IS NOT NULL, NOT)

func (*UnaryExpr) ToSQL

func (u *UnaryExpr) ToSQL() (string, []interface{})

Jump to

Keyboard shortcuts

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