Documentation
¶
Index ¶
- func ToPositional(placeholder string, expr Expression) (string, []any, error)
- type Expression
- func And(expr ...Expression) Expression
- func Append(expressions ...Expression) Expression
- func Compile(template string, expressions ...Expression) 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 Expression) Expression
- func IfElse(condition bool, then, els Expression) Expression
- func In(ident string, values ...any) Expression
- func Join(sep string, expressions ...Expression) Expression
- func Less(ident string, value any) Expression
- func LessOrEquals(ident string, value any) Expression
- func Not(expr Expression) Expression
- func NotEquals(ident string, value any) Expression
- func Or(left, right Expression) Expression
- func SQL(sql string, args ...any) Expression
- func Value(a any) Expression
- func Values(a ...any) Expression
- type ExpressionError
- type NumberOfArgumentsError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToPositional ¶ added in v0.0.11
func ToPositional(placeholder string, expr Expression) (string, []any, error)
Types ¶
type Expression ¶
Expression represents a prepared statement.
func Compile ¶ added in v0.0.10
func Compile(template string, expressions ...Expression) 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 Expression) 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 Expression) 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 ...Expression) Expression
Join joins expressions by 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.
type ExpressionError ¶ added in v0.0.11
type ExpressionError struct{}
ExpressionError is returned if expressions are nil.
func (ExpressionError) Error ¶ added in v0.0.11
func (e ExpressionError) Error() string
type NumberOfArgumentsError ¶ added in v0.0.11
type NumberOfArgumentsError struct{}
NumberOfArgumentsError is returned if arguments doesn't match the number of placeholders.
func (NumberOfArgumentsError) Error ¶ added in v0.0.11
func (e NumberOfArgumentsError) Error() string