Documentation
¶
Index ¶
- type BetweenExpr
- type BinaryExpr
- type CompareExpr
- type Expr
- func And(exprs ...Expr) Expr
- func Between[T any](col *table.Column[T], start, end T) Expr
- func Eq[T any](col *table.Column[T], value any) Expr
- func Ge[T any](col *table.Column[T], value any) Expr
- func Gt[T any](col *table.Column[T], value any) Expr
- func ILike(col *table.Column[string], pattern string) Expr
- func In[T any](col *table.Column[T], values ...T) Expr
- func IsNotNull[T any](col *table.Column[T]) Expr
- func IsNull[T any](col *table.Column[T]) Expr
- func Le[T any](col *table.Column[T], value any) Expr
- func Like(col *table.Column[string], pattern string) Expr
- func Lt[T any](col *table.Column[T], value any) Expr
- func Ne[T any](col *table.Column[T], value any) Expr
- func NotBetween[T any](col *table.Column[T], start, end T) Expr
- func NotIn[T any](col *table.Column[T], values ...T) Expr
- func NotLike(col *table.Column[string], pattern string) Expr
- func Or(exprs ...Expr) Expr
- func Raw(sql string, args ...interface{}) Expr
- type InExpr
- type LikeExpr
- type Literal
- type LogicalExpr
- type RawExpr
- type SQLValue
- type UnaryExpr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BetweenExpr ¶
BetweenExpr represents BETWEEN operations
func (*BetweenExpr) ToSQL ¶
func (b *BetweenExpr) ToSQL() (string, []interface{})
type BinaryExpr ¶
BinaryExpr represents a binary operation (=, !=, <, >, etc.)
func (*BinaryExpr) ToSQL ¶
func (b *BinaryExpr) ToSQL() (string, []interface{})
type CompareExpr ¶ added in v2.0.9
CompareExpr represents a comparison operation that supports both column and value comparisons
func (*CompareExpr) ToSQL ¶ added in v2.0.9
func (c *CompareExpr) 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 Eq ¶
Eq creates an equality expression (column = value OR column = column) Accepts either a raw value or another column (SQLValue)
func NotBetween ¶
NotBetween creates a NOT BETWEEN expression
type Literal ¶ added in v2.0.9
type Literal struct {
Val interface{}
}
Literal wraps a value to implement SQLValue interface
type LogicalExpr ¶
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
type SQLValue ¶ added in v2.0.9
type SQLValue interface {
// SQLString returns the SQL representation
// Returns (sqlString, isLiteral) where:
// - For columns: ("table.column", false)
// - For values: ("?", true) with the actual value stored separately
SQLString() (string, bool)
// Value returns the actual value if this is a literal, nil otherwise
Value() interface{}
}
SQLValue represents a value that can be used in SQL comparisons It can be either a column reference or a literal value