Documentation
¶
Index ¶
- Variables
- type Expression
- func Append(expressions ...Sqlizer) Expression
- func Compile(template string, expressions ...Sqlizer) Expression
- func Equals(ident string, value any) Expression
- func Greater(ident string, value any) Expression
- func GreaterOrEquals(ident string, value any) Expression
- func Idents(idents ...string) Expression
- func If(condition bool, then Sqlizer) Expression
- func IfElse(condition bool, then, els Sqlizer) Expression
- func In(ident string, values ...any) Expression
- func Join(sep string, expressions ...Sqlizer) Expression
- func Less(ident string, value any) Expression
- func LessOrEquals(ident string, value any) Expression
- func NotEquals(ident string, value any) Expression
- func SQL(sql string, args ...any) Expression
- func Value(a any) Expression
- func Values(a ...any) Expression
- type Sqlizer
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidExpression = errors.New("invalid expression")
ErrInvalidExpression is returned if expressions are nil.
var ErrInvalidNumberOfArguments = errors.New("invalid number of arguments")
ErrInvalidNumberOfArguments is returned if arguments doesn't match the number of placeholders.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
Expression represents a prepared statement.
func Append ¶
func Append(expressions ...Sqlizer) Expression
Append builds an Expression by appending Sqlizer's.
func Compile ¶ added in v0.0.10
func Compile(template string, expressions ...Sqlizer) Expression
Compile takes a template with placeholders into which expressions can be compiled. You can escape '?' by using '??'.
func Equals ¶ added in v0.0.6
func Equals(ident string, value any) Expression
Equals returns an expression with an '=' sign.
func Greater ¶ added in v0.0.6
func Greater(ident string, value any) Expression
Greater returns an expression with an '>' sign.
func GreaterOrEquals ¶ added in v0.0.6
func GreaterOrEquals(ident string, value any) Expression
GreaterOrEquals returns an expression with an '>=' sign.
func Idents ¶ added in v0.0.10
func Idents(idents ...string) Expression
Idents joins idents with ", " to an expression.
func If ¶
func If(condition bool, then Sqlizer) Expression
If returns an expression based on a condition. If false an empty expression is returned.
func IfElse ¶ added in v0.0.4
func IfElse(condition bool, then, els Sqlizer) Expression
IfElse returns an expression based on a condition.
func In ¶ added in v0.0.10
func In(ident string, values ...any) Expression
In returns an expression with an 'IN' sign.
func Join ¶
func Join(sep string, expressions ...Sqlizer) Expression
Join builds an Expression by joining Sqlizer's with a separator.
func Less ¶ added in v0.0.6
func Less(ident string, value any) Expression
Less returns an expression with an '<' sign.
func LessOrEquals ¶ added in v0.0.6
func LessOrEquals(ident string, value any) Expression
LessOrEquals returns an expression with an '<=' sign.
func NotEquals ¶ added in v0.0.6
func NotEquals(ident string, value any) Expression
NotEquals returns an expression with an '<>' sign.
func Value ¶ added in v0.0.10
func Value(a any) Expression
Value returns an expression with a placeholder.
func Values ¶ added in v0.0.3
func Values(a ...any) Expression
Values returns an expression with placeholders.
func (Expression) ToPositional ¶ added in v0.0.10
func (e Expression) ToPositional(placeholder string) (string, []any, error)