Documentation ¶
Index ¶
- Constants
- Variables
- func ArrayValue(value any) driver.Valuer
- func EnumValue(value Enumeration) driver.Valuer
- func EscapeQuote(str string, quote byte) string
- func FetchAll[T any](db DB, q Query, rowmapper func(*Row) T) ([]T, error)
- func FetchAllContext[T any](ctx context.Context, db DB, q Query, rowmapper func(*Row) T) ([]T, error)
- func FetchExists(db DB, q Query) (exists bool, err error)
- func FetchExistsContext(ctx context.Context, db DB, q Query) (exists bool, err error)
- func FetchOne[T any](db DB, q Query, rowmapper func(*Row) T) (T, error)
- func FetchOneContext[T any](ctx context.Context, db DB, q Query, rowmapper func(*Row) T) (T, error)
- func JSONValue(value any) driver.Valuer
- func Log(db DB) interface{ ... }
- func New[T Table](alias string) T
- func QuoteIdentifier(dialect string, identifier string) string
- func Sprint(dialect string, v any) (string, error)
- func Sprintf(dialect string, query string, args []any) (string, error)
- func ToSQL(dialect string, w SQLWriter, params map[string][]int) (query string, args []any, err error)
- func ToSQLContext(ctx context.Context, dialect string, w SQLWriter, params map[string][]int) (query string, args []any, err error)
- func UUIDValue(value any) driver.Valuer
- func VerboseLog(db DB) interface{ ... }
- func WriteValue(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- func Writef(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type Any
- type AnyField
- func (f AnyField) As(alias string) AnyField
- func (f AnyField) Asc() AnyField
- func (f AnyField) Desc() AnyField
- func (f AnyField) Eq(val any) Predicate
- func (f AnyField) Expr(format string, values ...any) Expression
- func (f AnyField) Ge(val any) Predicate
- func (f AnyField) GetAlias() string
- func (f AnyField) Gt(val any) Predicate
- func (f AnyField) In(val any) Predicate
- func (f AnyField) IsArray()
- func (f AnyField) IsBinary()
- func (f AnyField) IsBoolean()
- func (f AnyField) IsEnum()
- func (f AnyField) IsField()
- func (f AnyField) IsJSON()
- func (f AnyField) IsNotNull() Predicate
- func (f AnyField) IsNull() Predicate
- func (f AnyField) IsNumber()
- func (f AnyField) IsString()
- func (f AnyField) IsTime()
- func (f AnyField) IsUUID()
- func (f AnyField) Le(val any) Predicate
- func (f AnyField) Lt(val any) Predicate
- func (f AnyField) Ne(val any) Predicate
- func (f AnyField) NullsFirst() AnyField
- func (f AnyField) NullsLast() AnyField
- func (f AnyField) Set(val any) Assignment
- func (f AnyField) Setf(format string, values ...any) Assignment
- func (f AnyField) WithPrefix(prefix string) Field
- func (f AnyField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type Array
- type ArrayField
- func (f ArrayField) As(alias string) ArrayField
- func (f ArrayField) GetAlias() string
- func (f ArrayField) IsArray()
- func (f ArrayField) IsField()
- func (f ArrayField) IsNotNull() Predicate
- func (f ArrayField) IsNull() Predicate
- func (f ArrayField) Set(val any) Assignment
- func (f ArrayField) SetArray(val any) Assignment
- func (f ArrayField) Setf(format string, values ...any) Assignment
- func (f ArrayField) WithPrefix(prefix string) Field
- func (f ArrayField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type Assignment
- type Assignments
- type Binary
- type BinaryField
- func (f BinaryField) As(alias string) BinaryField
- func (f BinaryField) Asc() BinaryField
- func (f BinaryField) Desc() BinaryField
- func (f BinaryField) Eq(val Binary) Predicate
- func (f BinaryField) EqBytes(b []byte) Predicate
- func (f BinaryField) GetAlias() string
- func (f BinaryField) In(val any) Predicate
- func (f BinaryField) IsBinary()
- func (f BinaryField) IsField()
- func (f BinaryField) IsNotNull() Predicate
- func (f BinaryField) IsNull() Predicate
- func (f BinaryField) Ne(val Binary) Predicate
- func (f BinaryField) NeBytes(b []byte) Predicate
- func (f BinaryField) NullsFirst() BinaryField
- func (f BinaryField) NullsLast() BinaryField
- func (f BinaryField) Set(val any) Assignment
- func (f BinaryField) SetBytes(b []byte) Assignment
- func (f BinaryField) Setf(format string, values ...any) Assignment
- func (f BinaryField) WithPrefix(prefix string) Field
- func (f BinaryField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type BinaryParameter
- type Boolean
- type BooleanField
- func (f BooleanField) As(alias string) BooleanField
- func (f BooleanField) Asc() BooleanField
- func (f BooleanField) Desc() BooleanField
- func (f BooleanField) Eq(val Boolean) Predicate
- func (f BooleanField) EqBool(b bool) Predicate
- func (f BooleanField) GetAlias() string
- func (f BooleanField) IsBoolean()
- func (f BooleanField) IsField()
- func (f BooleanField) IsNotNull() Predicate
- func (f BooleanField) IsNull() Predicate
- func (f BooleanField) Ne(val Boolean) Predicate
- func (f BooleanField) NeBool(b bool) Predicate
- func (f BooleanField) NullsFirst() BooleanField
- func (f BooleanField) NullsLast() BooleanField
- func (f BooleanField) Set(val any) Assignment
- func (f BooleanField) SetBool(b bool) Assignment
- func (f BooleanField) Setf(format string, values ...any) Assignment
- func (f BooleanField) WithPrefix(prefix string) Field
- func (f BooleanField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type BooleanParameter
- type CTE
- func (cte CTE) As(alias string) CTE
- func (cte CTE) Field(name string) AnyField
- func (cte CTE) GetAlias() string
- func (cte CTE) IsTable()
- func (cte CTE) Materialized() CTE
- func (cte CTE) NotMaterialized() CTE
- func (cte CTE) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type CaseExpression
- func (e CaseExpression) As(alias string) CaseExpression
- func (e CaseExpression) Else(fallback any) CaseExpression
- func (e CaseExpression) GetAlias() string
- func (e CaseExpression) IsArray()
- func (e CaseExpression) IsBinary()
- func (e CaseExpression) IsBoolean()
- func (e CaseExpression) IsEnum()
- func (e CaseExpression) IsField()
- func (e CaseExpression) IsJSON()
- func (e CaseExpression) IsNumber()
- func (e CaseExpression) IsString()
- func (e CaseExpression) IsTime()
- func (e CaseExpression) IsUUID()
- func (e CaseExpression) When(predicate Predicate, result any) CaseExpression
- func (e CaseExpression) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type Column
- func (col *Column) Set(field Field, value any)
- func (col *Column) SetArray(field Array, value any)
- func (col *Column) SetBool(field Boolean, value bool)
- func (col *Column) SetBytes(field Binary, value []byte)
- func (col *Column) SetEnum(field Enum, value Enumeration)
- func (col *Column) SetFloat64(field Number, value float64)
- func (col *Column) SetInt(field Number, value int)
- func (col *Column) SetInt64(field Number, value int64)
- func (col *Column) SetJSON(field JSON, value any)
- func (col *Column) SetString(field String, value string)
- func (col *Column) SetTime(field Time, value time.Time)
- func (col *Column) SetUUID(field UUID, value any)
- type CompiledExec
- func (e *CompiledExec) Exec(db DB, params Params) (Result, error)
- func (e *CompiledExec) ExecContext(ctx context.Context, db DB, params Params) (Result, error)
- func (e *CompiledExec) GetSQL() (dialect string, query string, args []any, params map[string][]int)
- func (e *CompiledExec) Prepare(db DB) (*PreparedExec, error)
- func (e *CompiledExec) PrepareContext(ctx context.Context, db DB) (*PreparedExec, error)
- type CompiledFetch
- func CompileFetch[T any](q Query, rowmapper func(*Row) T) (*CompiledFetch[T], error)
- func CompileFetchContext[T any](ctx context.Context, q Query, rowmapper func(*Row) T) (f *CompiledFetch[T], err error)
- func NewCompiledFetch[T any](dialect string, query string, args []any, params map[string][]int, ...) *CompiledFetch[T]
- func (f *CompiledFetch[T]) FetchAll(db DB, params Params) ([]T, error)
- func (f *CompiledFetch[T]) FetchAllContext(ctx context.Context, db DB, params Params) ([]T, error)
- func (f *CompiledFetch[T]) FetchCursor(db DB, params Params) (*Cursor[T], error)
- func (f *CompiledFetch[T]) FetchCursorContext(ctx context.Context, db DB, params Params) (*Cursor[T], error)
- func (f *CompiledFetch[T]) FetchOne(db DB, params Params) (T, error)
- func (f *CompiledFetch[T]) FetchOneContext(ctx context.Context, db DB, params Params) (T, error)
- func (f *CompiledFetch[T]) GetSQL() (dialect string, query string, args []any, params map[string][]int, ...)
- func (f *CompiledFetch[T]) Prepare(db DB) (*PreparedFetch[T], error)
- func (f *CompiledFetch[T]) PrepareContext(ctx context.Context, db DB) (*PreparedFetch[T], error)
- type ConflictClause
- type Cursor
- type CustomQuery
- func (q CustomQuery) Append(format string, values ...any) CustomQuery
- func (q CustomQuery) GetDialect() string
- func (q CustomQuery) GetFetchableFields() []Field
- func (q CustomQuery) SetDialect(dialect string) CustomQuery
- func (q CustomQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q CustomQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type DB
- type DeleteQuery
- func (q DeleteQuery) GetDialect() string
- func (q DeleteQuery) GetFetchableFields() []Field
- func (q DeleteQuery) SetDialect(dialect string) DeleteQuery
- func (q DeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q DeleteQuery) Where(predicates ...Predicate) DeleteQuery
- func (q DeleteQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type DialectCase
- type DialectCases
- type DialectExpression
- func (e DialectExpression) DialectExpr(dialect string, format string, values ...any) DialectExpression
- func (e DialectExpression) DialectValue(dialect string, value any) DialectExpression
- func (e DialectExpression) IsArray()
- func (e DialectExpression) IsBinary()
- func (e DialectExpression) IsBoolean()
- func (e DialectExpression) IsEnum()
- func (e DialectExpression) IsField()
- func (e DialectExpression) IsJSON()
- func (e DialectExpression) IsNumber()
- func (e DialectExpression) IsString()
- func (e DialectExpression) IsTable()
- func (e DialectExpression) IsTime()
- func (e DialectExpression) IsUUID()
- func (e DialectExpression) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type DialectValuer
- type Enum
- type EnumField
- func (f EnumField) As(alias string) EnumField
- func (f EnumField) Eq(val any) Predicate
- func (f EnumField) EqEnum(val Enumeration) Predicate
- func (f EnumField) GetAlias() string
- func (f EnumField) IsEnum()
- func (f EnumField) IsField()
- func (f EnumField) IsNotNull() Predicate
- func (f EnumField) IsNull() Predicate
- func (f EnumField) Ne(val any) Predicate
- func (f EnumField) NeEnum(val Enumeration) Predicate
- func (f EnumField) Set(val any) Assignment
- func (f EnumField) SetEnum(val Enumeration) Assignment
- func (f EnumField) Setf(format string, values ...any) Assignment
- func (f EnumField) WithPrefix(prefix string) Field
- func (f EnumField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type Enumeration
- type Expression
- func Avg(num Number) Expression
- func AvgOver(num Number, window Window) Expression
- func Count(field Field) Expression
- func CountOver(field Field, window Window) Expression
- func CountStar() Expression
- func CountStarOver(window Window) Expression
- func CumeDistOver(window Window) Expression
- func DenseRankOver(window Window) Expression
- func Expr(format string, values ...any) Expression
- func FirstValueOver(field Field, window Window) Expression
- func LastValueOver(field Field, window Window) Expression
- func Max(field Field) Expression
- func MaxOver(field Field, window Window) Expression
- func Min(field Field) Expression
- func MinOver(field Field, window Window) Expression
- func RankOver(window Window) Expression
- func RowNumberOver(window Window) Expression
- func Sum(num Number) Expression
- func SumOver(num Number, window Window) Expression
- func (e Expression) As(alias string) Expression
- func (e Expression) Eq(val any) Predicate
- func (e Expression) Ge(val any) Predicate
- func (e Expression) GetAlias() string
- func (e Expression) Gt(val any) Predicate
- func (e Expression) In(val any) Predicate
- func (e Expression) IsArray()
- func (e Expression) IsAssignment()
- func (e Expression) IsBinary()
- func (e Expression) IsBoolean()
- func (e Expression) IsEnum()
- func (e Expression) IsField()
- func (e Expression) IsJSON()
- func (e Expression) IsNumber()
- func (e Expression) IsString()
- func (e Expression) IsTable()
- func (e Expression) IsTime()
- func (e Expression) IsUUID()
- func (e Expression) Le(val any) Predicate
- func (e Expression) Lt(val any) Predicate
- func (e Expression) Ne(val any) Predicate
- func (e Expression) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type Field
- type Fields
- type Identifier
- type InsertQuery
- func (q InsertQuery) ColumnValues(colmapper func(*Column)) InsertQuery
- func (q InsertQuery) Columns(fields ...Field) InsertQuery
- func (q InsertQuery) GetDialect() string
- func (q InsertQuery) GetFetchableFields() []Field
- func (q InsertQuery) Select(query Query) InsertQuery
- func (q InsertQuery) SetDialect(dialect string) InsertQuery
- func (q InsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q InsertQuery) Values(values ...any) InsertQuery
- func (q InsertQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) (err error)
- type JSON
- type JSONField
- func (f JSONField) As(alias string) JSONField
- func (f JSONField) GetAlias() string
- func (f JSONField) IsBinary()
- func (f JSONField) IsField()
- func (f JSONField) IsJSON()
- func (f JSONField) IsNotNull() Predicate
- func (f JSONField) IsNull() Predicate
- func (f JSONField) IsString()
- func (f JSONField) Set(val any) Assignment
- func (f JSONField) SetJSON(val any) Assignment
- func (f JSONField) Setf(format string, values ...any) Assignment
- func (f JSONField) WithPrefix(prefix string) Field
- func (f JSONField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type JoinTable
- func CrossJoin(table Table) JoinTable
- func CustomJoin(joinOperator string, table Table, predicates ...Predicate) JoinTable
- func FullJoin(table Table, predicates ...Predicate) JoinTable
- func Join(table Table, predicates ...Predicate) JoinTable
- func JoinUsing(table Table, fields ...Field) JoinTable
- func LeftJoin(table Table, predicates ...Predicate) JoinTable
- type LiteralValue
- func (v LiteralValue) As(alias string) LiteralValue
- func (v LiteralValue) Eq(val any) Predicate
- func (v LiteralValue) Ge(val any) Predicate
- func (v LiteralValue) GetAlias() string
- func (v LiteralValue) Gt(val any) Predicate
- func (v LiteralValue) In(val any) Predicate
- func (v LiteralValue) IsBinary()
- func (v LiteralValue) IsBoolean()
- func (v LiteralValue) IsField()
- func (v LiteralValue) IsNumber()
- func (v LiteralValue) IsString()
- func (v LiteralValue) IsTime()
- func (v LiteralValue) Le(val any) Predicate
- func (v LiteralValue) Lt(val any) Predicate
- func (v LiteralValue) Ne(val any) Predicate
- func (v LiteralValue) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type LogSettings
- type LoggerConfig
- type MySQLDeleteQuery
- func (q MySQLDeleteQuery) CrossJoin(table Table) MySQLDeleteQuery
- func (q MySQLDeleteQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) MySQLDeleteQuery
- func (q MySQLDeleteQuery) From(table Table) MySQLDeleteQuery
- func (q MySQLDeleteQuery) FullJoin(table Table, predicates ...Predicate) MySQLDeleteQuery
- func (q MySQLDeleteQuery) GetDialect() string
- func (q MySQLDeleteQuery) GetFetchableFields() []Field
- func (q MySQLDeleteQuery) Join(table Table, predicates ...Predicate) MySQLDeleteQuery
- func (q MySQLDeleteQuery) JoinUsing(table Table, fields ...Field) MySQLDeleteQuery
- func (q MySQLDeleteQuery) LeftJoin(table Table, predicates ...Predicate) MySQLDeleteQuery
- func (q MySQLDeleteQuery) Limit(limit any) MySQLDeleteQuery
- func (q MySQLDeleteQuery) OrderBy(fields ...Field) MySQLDeleteQuery
- func (q MySQLDeleteQuery) SetDialect(dialect string) MySQLDeleteQuery
- func (q MySQLDeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q MySQLDeleteQuery) Where(predicates ...Predicate) MySQLDeleteQuery
- func (q MySQLDeleteQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type MySQLInsertQuery
- func (q MySQLInsertQuery) As(rowAlias string) MySQLInsertQuery
- func (q MySQLInsertQuery) ColumnValues(colmapper func(*Column)) MySQLInsertQuery
- func (q MySQLInsertQuery) Columns(fields ...Field) MySQLInsertQuery
- func (q MySQLInsertQuery) GetDialect() string
- func (q MySQLInsertQuery) GetFetchableFields() []Field
- func (q MySQLInsertQuery) OnDuplicateKeyUpdate(assignments ...Assignment) MySQLInsertQuery
- func (q MySQLInsertQuery) Select(query Query) MySQLInsertQuery
- func (q MySQLInsertQuery) SetDialect(dialect string) MySQLInsertQuery
- func (q MySQLInsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q MySQLInsertQuery) Values(values ...any) MySQLInsertQuery
- func (q MySQLInsertQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type MySQLSelectQuery
- func (q MySQLSelectQuery) As(alias string, columns ...string) MySQLSelectQuery
- func (q MySQLSelectQuery) CrossJoin(table Table) MySQLSelectQuery
- func (q MySQLSelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) MySQLSelectQuery
- func (q MySQLSelectQuery) Field(name string) AnyField
- func (q MySQLSelectQuery) From(table Table) MySQLSelectQuery
- func (q MySQLSelectQuery) FullJoin(table Table, predicates ...Predicate) MySQLSelectQuery
- func (q MySQLSelectQuery) GetAlias() string
- func (q MySQLSelectQuery) GetDialect() string
- func (q MySQLSelectQuery) GetFetchableFields() []Field
- func (q MySQLSelectQuery) GroupBy(fields ...Field) MySQLSelectQuery
- func (q MySQLSelectQuery) Having(predicates ...Predicate) MySQLSelectQuery
- func (q MySQLSelectQuery) IsArray()
- func (q MySQLSelectQuery) IsBinary()
- func (q MySQLSelectQuery) IsBoolean()
- func (q MySQLSelectQuery) IsEnum()
- func (q MySQLSelectQuery) IsField()
- func (q MySQLSelectQuery) IsJSON()
- func (q MySQLSelectQuery) IsNumber()
- func (q MySQLSelectQuery) IsString()
- func (q MySQLSelectQuery) IsTable()
- func (q MySQLSelectQuery) IsTime()
- func (q MySQLSelectQuery) IsUUID()
- func (q MySQLSelectQuery) Join(table Table, predicates ...Predicate) MySQLSelectQuery
- func (q MySQLSelectQuery) JoinUsing(table Table, fields ...Field) MySQLSelectQuery
- func (q MySQLSelectQuery) LeftJoin(table Table, predicates ...Predicate) MySQLSelectQuery
- func (q MySQLSelectQuery) Limit(limit any) MySQLSelectQuery
- func (q MySQLSelectQuery) LockRows(lockClause string, lockValues ...any) MySQLSelectQuery
- func (q MySQLSelectQuery) Offset(offset any) MySQLSelectQuery
- func (q MySQLSelectQuery) OrderBy(fields ...Field) MySQLSelectQuery
- func (q MySQLSelectQuery) Select(fields ...Field) MySQLSelectQuery
- func (q MySQLSelectQuery) SelectDistinct(fields ...Field) MySQLSelectQuery
- func (q MySQLSelectQuery) SelectOne(fields ...Field) MySQLSelectQuery
- func (q MySQLSelectQuery) SetDialect(dialect string) MySQLSelectQuery
- func (q MySQLSelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q MySQLSelectQuery) Where(predicates ...Predicate) MySQLSelectQuery
- func (q MySQLSelectQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type MySQLUpdateQuery
- func (q MySQLUpdateQuery) CrossJoin(table Table) MySQLUpdateQuery
- func (q MySQLUpdateQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) MySQLUpdateQuery
- func (q MySQLUpdateQuery) FullJoin(table Table, predicates ...Predicate) MySQLUpdateQuery
- func (q MySQLUpdateQuery) GetDialect() string
- func (q MySQLUpdateQuery) GetFetchableFields() []Field
- func (q MySQLUpdateQuery) Join(table Table, predicates ...Predicate) MySQLUpdateQuery
- func (q MySQLUpdateQuery) JoinUsing(table Table, fields ...Field) MySQLUpdateQuery
- func (q MySQLUpdateQuery) LeftJoin(table Table, predicates ...Predicate) MySQLUpdateQuery
- func (q MySQLUpdateQuery) Limit(limit any) MySQLUpdateQuery
- func (q MySQLUpdateQuery) OrderBy(fields ...Field) MySQLUpdateQuery
- func (q MySQLUpdateQuery) Set(assignments ...Assignment) MySQLUpdateQuery
- func (q MySQLUpdateQuery) SetDialect(dialect string) MySQLUpdateQuery
- func (q MySQLUpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q MySQLUpdateQuery) SetFunc(colmapper func(*Column)) MySQLUpdateQuery
- func (q MySQLUpdateQuery) Where(predicates ...Predicate) MySQLUpdateQuery
- func (q MySQLUpdateQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type NamedWindow
- type NamedWindows
- type Number
- type NumberField
- func (f NumberField) As(alias string) NumberField
- func (f NumberField) Asc() NumberField
- func (f NumberField) Desc() NumberField
- func (f NumberField) Eq(val Number) Predicate
- func (f NumberField) EqFloat64(num float64) Predicate
- func (f NumberField) EqInt(num int) Predicate
- func (f NumberField) EqInt64(num int64) Predicate
- func (f NumberField) Ge(val Number) Predicate
- func (f NumberField) GeFloat64(num float64) Predicate
- func (f NumberField) GeInt(num int) Predicate
- func (f NumberField) GeInt64(num int64) Predicate
- func (f NumberField) GetAlias() string
- func (f NumberField) Gt(val Number) Predicate
- func (f NumberField) GtFloat64(num float64) Predicate
- func (f NumberField) GtInt(num int) Predicate
- func (f NumberField) GtInt64(num int64) Predicate
- func (f NumberField) In(val any) Predicate
- func (f NumberField) IsField()
- func (f NumberField) IsNotNull() Predicate
- func (f NumberField) IsNull() Predicate
- func (f NumberField) IsNumber()
- func (f NumberField) Le(val Number) Predicate
- func (f NumberField) LeFloat64(num float64) Predicate
- func (f NumberField) LeInt(num int) Predicate
- func (f NumberField) LeInt64(num int64) Predicate
- func (f NumberField) Lt(val Number) Predicate
- func (f NumberField) LtFloat64(num float64) Predicate
- func (f NumberField) LtInt(num int) Predicate
- func (f NumberField) LtInt64(num int64) Predicate
- func (f NumberField) Ne(val Number) Predicate
- func (f NumberField) NeFloat64(num float64) Predicate
- func (f NumberField) NeInt(num int) Predicate
- func (f NumberField) NeInt64(num int64) Predicate
- func (f NumberField) NullsFirst() NumberField
- func (f NumberField) NullsLast() NumberField
- func (f NumberField) Set(val any) Assignment
- func (f NumberField) SetFloat64(num float64) Assignment
- func (f NumberField) SetInt(num int) Assignment
- func (f NumberField) SetInt64(num int64) Assignment
- func (f NumberField) Setf(format string, values ...any) Assignment
- func (f NumberField) WithPrefix(prefix string) Field
- func (f NumberField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type NumberParameter
- type Parameter
- type Params
- type PolicyTable
- type PostgresDeleteQuery
- func (q PostgresDeleteQuery) CrossJoin(table Table) PostgresDeleteQuery
- func (q PostgresDeleteQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) PostgresDeleteQuery
- func (q PostgresDeleteQuery) FullJoin(table Table, predicates ...Predicate) PostgresDeleteQuery
- func (q PostgresDeleteQuery) GetDialect() string
- func (q PostgresDeleteQuery) GetFetchableFields() []Field
- func (q PostgresDeleteQuery) Join(table Table, predicates ...Predicate) PostgresDeleteQuery
- func (q PostgresDeleteQuery) JoinUsing(table Table, fields ...Field) PostgresDeleteQuery
- func (q PostgresDeleteQuery) LeftJoin(table Table, predicates ...Predicate) PostgresDeleteQuery
- func (q PostgresDeleteQuery) Returning(fields ...Field) PostgresDeleteQuery
- func (q PostgresDeleteQuery) SetDialect(dialect string) PostgresDeleteQuery
- func (q PostgresDeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q PostgresDeleteQuery) Using(table Table) PostgresDeleteQuery
- func (q PostgresDeleteQuery) Where(predicates ...Predicate) PostgresDeleteQuery
- func (q PostgresDeleteQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type PostgresInsertQuery
- func (q PostgresInsertQuery) ColumnValues(colmapper func(*Column)) PostgresInsertQuery
- func (q PostgresInsertQuery) Columns(fields ...Field) PostgresInsertQuery
- func (q PostgresInsertQuery) GetDialect() string
- func (q PostgresInsertQuery) GetFetchableFields() []Field
- func (q PostgresInsertQuery) OnConflict(fields ...Field) postgresInsertConflict
- func (q PostgresInsertQuery) OnConflictOnConstraint(constraintName string) postgresInsertConflict
- func (q PostgresInsertQuery) Returning(fields ...Field) PostgresInsertQuery
- func (q PostgresInsertQuery) Select(query Query) PostgresInsertQuery
- func (q PostgresInsertQuery) SetDialect(dialect string) PostgresInsertQuery
- func (q PostgresInsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q PostgresInsertQuery) Values(values ...any) PostgresInsertQuery
- func (q PostgresInsertQuery) Where(predicates ...Predicate) PostgresInsertQuery
- func (q PostgresInsertQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type PostgresSelectQuery
- func (q PostgresSelectQuery) As(alias string, columns ...string) PostgresSelectQuery
- func (q PostgresSelectQuery) CrossJoin(table Table) PostgresSelectQuery
- func (q PostgresSelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) PostgresSelectQuery
- func (q PostgresSelectQuery) DistinctOn(fields ...Field) PostgresSelectQuery
- func (q PostgresSelectQuery) FetchNext(n any) PostgresSelectQuery
- func (q PostgresSelectQuery) Field(name string) AnyField
- func (q PostgresSelectQuery) From(table Table) PostgresSelectQuery
- func (q PostgresSelectQuery) FullJoin(table Table, predicates ...Predicate) PostgresSelectQuery
- func (q PostgresSelectQuery) GetAlias() string
- func (q PostgresSelectQuery) GetDialect() string
- func (q PostgresSelectQuery) GetFetchableFields() []Field
- func (q PostgresSelectQuery) GroupBy(fields ...Field) PostgresSelectQuery
- func (q PostgresSelectQuery) Having(predicates ...Predicate) PostgresSelectQuery
- func (q PostgresSelectQuery) IsArray()
- func (q PostgresSelectQuery) IsBinary()
- func (q PostgresSelectQuery) IsBoolean()
- func (q PostgresSelectQuery) IsEnum()
- func (q PostgresSelectQuery) IsField()
- func (q PostgresSelectQuery) IsJSON()
- func (q PostgresSelectQuery) IsNumber()
- func (q PostgresSelectQuery) IsString()
- func (q PostgresSelectQuery) IsTable()
- func (q PostgresSelectQuery) IsTime()
- func (q PostgresSelectQuery) IsUUID()
- func (q PostgresSelectQuery) Join(table Table, predicates ...Predicate) PostgresSelectQuery
- func (q PostgresSelectQuery) JoinUsing(table Table, fields ...Field) PostgresSelectQuery
- func (q PostgresSelectQuery) LeftJoin(table Table, predicates ...Predicate) PostgresSelectQuery
- func (q PostgresSelectQuery) Limit(limit any) PostgresSelectQuery
- func (q PostgresSelectQuery) LockRows(lockClause string, lockValues ...any) PostgresSelectQuery
- func (q PostgresSelectQuery) Offset(offset any) PostgresSelectQuery
- func (q PostgresSelectQuery) OrderBy(fields ...Field) PostgresSelectQuery
- func (q PostgresSelectQuery) Select(fields ...Field) PostgresSelectQuery
- func (q PostgresSelectQuery) SelectDistinct(fields ...Field) PostgresSelectQuery
- func (q PostgresSelectQuery) SelectOne(fields ...Field) PostgresSelectQuery
- func (q PostgresSelectQuery) SetDialect(dialect string) PostgresSelectQuery
- func (q PostgresSelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q PostgresSelectQuery) Where(predicates ...Predicate) PostgresSelectQuery
- func (q PostgresSelectQuery) WithTies() PostgresSelectQuery
- func (q PostgresSelectQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type PostgresUpdateQuery
- func (q PostgresUpdateQuery) CrossJoin(table Table) PostgresUpdateQuery
- func (q PostgresUpdateQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) PostgresUpdateQuery
- func (q PostgresUpdateQuery) From(table Table) PostgresUpdateQuery
- func (q PostgresUpdateQuery) FullJoin(table Table, predicates ...Predicate) PostgresUpdateQuery
- func (q PostgresUpdateQuery) GetDialect() string
- func (q PostgresUpdateQuery) GetFetchableFields() []Field
- func (q PostgresUpdateQuery) Join(table Table, predicates ...Predicate) PostgresUpdateQuery
- func (q PostgresUpdateQuery) JoinUsing(table Table, fields ...Field) PostgresUpdateQuery
- func (q PostgresUpdateQuery) LeftJoin(table Table, predicates ...Predicate) PostgresUpdateQuery
- func (q PostgresUpdateQuery) Returning(fields ...Field) PostgresUpdateQuery
- func (q PostgresUpdateQuery) Set(assignments ...Assignment) PostgresUpdateQuery
- func (q PostgresUpdateQuery) SetDialect(dialect string) PostgresUpdateQuery
- func (q PostgresUpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q PostgresUpdateQuery) SetFunc(colmapper func(*Column)) PostgresUpdateQuery
- func (q PostgresUpdateQuery) Where(predicates ...Predicate) PostgresUpdateQuery
- func (q PostgresUpdateQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type Predicate
- type PredicateCase
- type PredicateCases
- type PreparedExec
- type PreparedFetch
- func (f *PreparedFetch[T]) Close() error
- func (f *PreparedFetch[T]) FetchAll(params Params) ([]T, error)
- func (f *PreparedFetch[T]) FetchAllContext(ctx context.Context, params Params) ([]T, error)
- func (f PreparedFetch[T]) FetchCursor(params Params) (*Cursor[T], error)
- func (f PreparedFetch[T]) FetchCursorContext(ctx context.Context, params Params) (*Cursor[T], error)
- func (f *PreparedFetch[T]) FetchOne(params Params) (T, error)
- func (f *PreparedFetch[T]) FetchOneContext(ctx context.Context, params Params) (T, error)
- func (f *PreparedFetch[T]) GetCompiled() *CompiledFetch[T]
- type Query
- type QueryStats
- type Result
- type Row
- func (r *Row) Array(dest any, format string, values ...any)
- func (r *Row) ArrayField(dest any, field Array)
- func (r *Row) Bool(format string, values ...any) bool
- func (r *Row) BoolField(field Boolean) bool
- func (r *Row) Bytes(format string, values ...any) []byte
- func (r *Row) BytesField(field Binary) []byte
- func (r *Row) Enum(dest Enumeration, format string, values ...any)
- func (r *Row) EnumField(dest Enumeration, field Enum)
- func (r *Row) Float64(format string, values ...any) float64
- func (r *Row) Float64Field(field Number) float64
- func (r *Row) Int(format string, values ...any) int
- func (r *Row) Int64(format string, values ...any) int64
- func (r *Row) Int64Field(field Number) int64
- func (r *Row) IntField(field Number) int
- func (r *Row) JSON(dest any, format string, values ...any)
- func (r *Row) JSONField(dest any, field JSON)
- func (r *Row) NullBool(format string, values ...any) sql.NullBool
- func (r *Row) NullBoolField(field Boolean) sql.NullBool
- func (r *Row) NullFloat64(format string, values ...any) sql.NullFloat64
- func (r *Row) NullFloat64Field(field Number) sql.NullFloat64
- func (r *Row) NullInt64(format string, values ...any) sql.NullInt64
- func (r *Row) NullInt64Field(field Number) sql.NullInt64
- func (r *Row) NullString(format string, values ...any) sql.NullString
- func (r *Row) NullStringField(field String) sql.NullString
- func (r *Row) NullTime(format string, values ...any) sql.NullTime
- func (r *Row) NullTimeField(field Time) sql.NullTime
- func (r *Row) Scan(dest any, format string, values ...any)
- func (r *Row) ScanField(dest any, field Field)
- func (r *Row) String(format string, values ...any) string
- func (r *Row) StringField(field String) string
- func (r *Row) Time(format string, values ...any) time.Time
- func (r *Row) TimeField(field Time) time.Time
- func (r *Row) UUID(dest any, format string, values ...any)
- func (r *Row) UUIDField(dest any, field UUID)
- type RowValue
- type RowValues
- type SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) CrossJoin(table Table) SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) From(table Table) SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) FullJoin(table Table, predicates ...Predicate) SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) GetDialect() string
- func (q SQLServerDeleteQuery) GetFetchableFields() []Field
- func (q SQLServerDeleteQuery) Join(table Table, predicates ...Predicate) SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) LeftJoin(table Table, predicates ...Predicate) SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) SetDialect(dialect string) SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SQLServerDeleteQuery) Where(predicates ...Predicate) SQLServerDeleteQuery
- func (q SQLServerDeleteQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SQLServerInsertQuery
- func (q SQLServerInsertQuery) ColumnValues(colmapper func(*Column)) SQLServerInsertQuery
- func (q SQLServerInsertQuery) Columns(fields ...Field) SQLServerInsertQuery
- func (q SQLServerInsertQuery) GetDialect() string
- func (q SQLServerInsertQuery) GetFetchableFields() []Field
- func (q SQLServerInsertQuery) Select(query Query) SQLServerInsertQuery
- func (q SQLServerInsertQuery) SetDialect(dialect string) SQLServerInsertQuery
- func (q SQLServerInsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SQLServerInsertQuery) Values(values ...any) SQLServerInsertQuery
- func (q SQLServerInsertQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SQLServerSelectQuery
- func (q SQLServerSelectQuery) As(alias string, columns ...string) SQLServerSelectQuery
- func (q SQLServerSelectQuery) CrossJoin(table Table) SQLServerSelectQuery
- func (q SQLServerSelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLServerSelectQuery
- func (q SQLServerSelectQuery) FetchNext(n any) SQLServerSelectQuery
- func (q SQLServerSelectQuery) Field(name string) AnyField
- func (q SQLServerSelectQuery) From(table Table) SQLServerSelectQuery
- func (q SQLServerSelectQuery) FullJoin(table Table, predicates ...Predicate) SQLServerSelectQuery
- func (q SQLServerSelectQuery) GetAlias() string
- func (q SQLServerSelectQuery) GetDialect() string
- func (q SQLServerSelectQuery) GetFetchableFields() []Field
- func (q SQLServerSelectQuery) GroupBy(fields ...Field) SQLServerSelectQuery
- func (q SQLServerSelectQuery) Having(predicates ...Predicate) SQLServerSelectQuery
- func (q SQLServerSelectQuery) IsArray()
- func (q SQLServerSelectQuery) IsBinary()
- func (q SQLServerSelectQuery) IsBoolean()
- func (q SQLServerSelectQuery) IsEnum()
- func (q SQLServerSelectQuery) IsField()
- func (q SQLServerSelectQuery) IsJSON()
- func (q SQLServerSelectQuery) IsNumber()
- func (q SQLServerSelectQuery) IsString()
- func (q SQLServerSelectQuery) IsTable()
- func (q SQLServerSelectQuery) IsTime()
- func (q SQLServerSelectQuery) IsUUID()
- func (q SQLServerSelectQuery) Join(table Table, predicates ...Predicate) SQLServerSelectQuery
- func (q SQLServerSelectQuery) LeftJoin(table Table, predicates ...Predicate) SQLServerSelectQuery
- func (q SQLServerSelectQuery) Offset(offset any) SQLServerSelectQuery
- func (q SQLServerSelectQuery) OrderBy(fields ...Field) SQLServerSelectQuery
- func (q SQLServerSelectQuery) Select(fields ...Field) SQLServerSelectQuery
- func (q SQLServerSelectQuery) SelectDistinct(fields ...Field) SQLServerSelectQuery
- func (q SQLServerSelectQuery) SelectOne(fields ...Field) SQLServerSelectQuery
- func (q SQLServerSelectQuery) SetDialect(dialect string) SQLServerSelectQuery
- func (q SQLServerSelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SQLServerSelectQuery) Top(limit any) SQLServerSelectQuery
- func (q SQLServerSelectQuery) TopPercent(percentLimit any) SQLServerSelectQuery
- func (q SQLServerSelectQuery) Where(predicates ...Predicate) SQLServerSelectQuery
- func (q SQLServerSelectQuery) WithTies() SQLServerSelectQuery
- func (q SQLServerSelectQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) CrossJoin(table Table) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) From(table Table) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) FullJoin(table Table, predicates ...Predicate) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) GetDialect() string
- func (q SQLServerUpdateQuery) GetFetchableFields() []Field
- func (q SQLServerUpdateQuery) Join(table Table, predicates ...Predicate) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) LeftJoin(table Table, predicates ...Predicate) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) Set(assignments ...Assignment) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) SetDialect(dialect string) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SQLServerUpdateQuery) SetFunc(colmapper func(*Column)) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) Where(predicates ...Predicate) SQLServerUpdateQuery
- func (q SQLServerUpdateQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SQLWriter
- type SQLiteDeleteQuery
- func (q SQLiteDeleteQuery) GetDialect() string
- func (q SQLiteDeleteQuery) GetFetchableFields() []Field
- func (q SQLiteDeleteQuery) Returning(fields ...Field) SQLiteDeleteQuery
- func (q SQLiteDeleteQuery) SetDialect(dialect string) SQLiteDeleteQuery
- func (q SQLiteDeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SQLiteDeleteQuery) Where(predicates ...Predicate) SQLiteDeleteQuery
- func (q SQLiteDeleteQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SQLiteInsertQuery
- func (q SQLiteInsertQuery) ColumnValues(colmapper func(*Column)) SQLiteInsertQuery
- func (q SQLiteInsertQuery) Columns(fields ...Field) SQLiteInsertQuery
- func (q SQLiteInsertQuery) GetDialect() string
- func (q SQLiteInsertQuery) GetFetchableFields() []Field
- func (q SQLiteInsertQuery) OnConflict(fields ...Field) sqliteInsertConflict
- func (q SQLiteInsertQuery) Returning(fields ...Field) SQLiteInsertQuery
- func (q SQLiteInsertQuery) Select(query Query) SQLiteInsertQuery
- func (q SQLiteInsertQuery) SetDialect(dialect string) SQLiteInsertQuery
- func (q SQLiteInsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SQLiteInsertQuery) Values(values ...any) SQLiteInsertQuery
- func (q SQLiteInsertQuery) Where(predicates ...Predicate) SQLiteInsertQuery
- func (q SQLiteInsertQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SQLiteSelectQuery
- func (q SQLiteSelectQuery) As(alias string, columns ...string) SQLiteSelectQuery
- func (q SQLiteSelectQuery) CrossJoin(table Table) SQLiteSelectQuery
- func (q SQLiteSelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLiteSelectQuery
- func (q SQLiteSelectQuery) Field(name string) AnyField
- func (q SQLiteSelectQuery) From(table Table) SQLiteSelectQuery
- func (q SQLiteSelectQuery) GetAlias() string
- func (q SQLiteSelectQuery) GetDialect() string
- func (q SQLiteSelectQuery) GetFetchableFields() []Field
- func (q SQLiteSelectQuery) GroupBy(fields ...Field) SQLiteSelectQuery
- func (q SQLiteSelectQuery) Having(predicates ...Predicate) SQLiteSelectQuery
- func (q SQLiteSelectQuery) IsArray()
- func (q SQLiteSelectQuery) IsBinary()
- func (q SQLiteSelectQuery) IsBoolean()
- func (q SQLiteSelectQuery) IsEnum()
- func (q SQLiteSelectQuery) IsField()
- func (q SQLiteSelectQuery) IsJSON()
- func (q SQLiteSelectQuery) IsNumber()
- func (q SQLiteSelectQuery) IsString()
- func (q SQLiteSelectQuery) IsTable()
- func (q SQLiteSelectQuery) IsTime()
- func (q SQLiteSelectQuery) IsUUID()
- func (q SQLiteSelectQuery) Join(table Table, predicates ...Predicate) SQLiteSelectQuery
- func (q SQLiteSelectQuery) JoinUsing(table Table, fields ...Field) SQLiteSelectQuery
- func (q SQLiteSelectQuery) LeftJoin(table Table, predicates ...Predicate) SQLiteSelectQuery
- func (q SQLiteSelectQuery) Limit(limit any) SQLiteSelectQuery
- func (q SQLiteSelectQuery) Offset(offset any) SQLiteSelectQuery
- func (q SQLiteSelectQuery) OrderBy(fields ...Field) SQLiteSelectQuery
- func (q SQLiteSelectQuery) Select(fields ...Field) SQLiteSelectQuery
- func (q SQLiteSelectQuery) SelectDistinct(fields ...Field) SQLiteSelectQuery
- func (q SQLiteSelectQuery) SelectOne(fields ...Field) SQLiteSelectQuery
- func (q SQLiteSelectQuery) SetDialect(dialect string) SQLiteSelectQuery
- func (q SQLiteSelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SQLiteSelectQuery) Where(predicates ...Predicate) SQLiteSelectQuery
- func (q SQLiteSelectQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) CrossJoin(table Table) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) From(table Table) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) GetDialect() string
- func (q SQLiteUpdateQuery) GetFetchableFields() []Field
- func (q SQLiteUpdateQuery) Join(table Table, predicates ...Predicate) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) JoinUsing(table Table, fields ...Field) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) LeftJoin(table Table, predicates ...Predicate) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) Returning(fields ...Field) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) Set(assignments ...Assignment) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) SetDialect(dialect string) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SQLiteUpdateQuery) SetFunc(colmapper func(*Column)) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) Where(predicates ...Predicate) SQLiteUpdateQuery
- func (q SQLiteUpdateQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SelectQuery
- func (q SelectQuery) As(alias string, columns ...string) SelectQuery
- func (q SelectQuery) CrossJoin(table Table) SelectQuery
- func (q SelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SelectQuery
- func (q SelectQuery) Field(name string) AnyField
- func (q SelectQuery) From(table Table) SelectQuery
- func (q SelectQuery) GetAlias() string
- func (q SelectQuery) GetColumns() []string
- func (q SelectQuery) GetDialect() string
- func (q SelectQuery) GetFetchableFields() []Field
- func (q SelectQuery) GroupBy(fields ...Field) SelectQuery
- func (q SelectQuery) Having(predicates ...Predicate) SelectQuery
- func (q SelectQuery) IsArray()
- func (q SelectQuery) IsBinary()
- func (q SelectQuery) IsBoolean()
- func (q SelectQuery) IsEnum()
- func (q SelectQuery) IsField()
- func (q SelectQuery) IsJSON()
- func (q SelectQuery) IsNumber()
- func (q SelectQuery) IsString()
- func (q SelectQuery) IsTable()
- func (q SelectQuery) IsTime()
- func (q SelectQuery) IsUUID()
- func (q SelectQuery) Join(table Table, predicates ...Predicate) SelectQuery
- func (q SelectQuery) JoinUsing(table Table, fields ...Field) SelectQuery
- func (q SelectQuery) LeftJoin(table Table, predicates ...Predicate) SelectQuery
- func (q SelectQuery) Limit(limit any) SelectQuery
- func (q SelectQuery) Offset(offset any) SelectQuery
- func (q SelectQuery) OrderBy(fields ...Field) SelectQuery
- func (q SelectQuery) Select(fields ...Field) SelectQuery
- func (q SelectQuery) SelectDistinct(fields ...Field) SelectQuery
- func (q SelectQuery) SelectOne(fields ...Field) SelectQuery
- func (q SelectQuery) SetDialect(dialect string) SelectQuery
- func (q SelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q SelectQuery) Where(predicates ...Predicate) SelectQuery
- func (q SelectQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SelectValues
- func (vs SelectValues) Field(name string) AnyField
- func (vs SelectValues) GetAlias() string
- func (vs SelectValues) GetDialect() string
- func (vs SelectValues) GetFetchableFields() []Field
- func (vs SelectValues) IsTable()
- func (vs SelectValues) SetFetchableFields([]Field) (query Query, ok bool)
- func (vs SelectValues) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SimpleCase
- type SimpleCaseExpression
- func (e SimpleCaseExpression) As(alias string) SimpleCaseExpression
- func (e SimpleCaseExpression) Else(fallback any) SimpleCaseExpression
- func (e SimpleCaseExpression) GetAlias() string
- func (e SimpleCaseExpression) IsArray()
- func (e SimpleCaseExpression) IsBinary()
- func (e SimpleCaseExpression) IsBoolean()
- func (e SimpleCaseExpression) IsEnum()
- func (e SimpleCaseExpression) IsField()
- func (e SimpleCaseExpression) IsJSON()
- func (e SimpleCaseExpression) IsNumber()
- func (e SimpleCaseExpression) IsString()
- func (e SimpleCaseExpression) IsTime()
- func (e SimpleCaseExpression) IsUUID()
- func (e SimpleCaseExpression) When(value any, result any) SimpleCaseExpression
- func (e SimpleCaseExpression) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type SimpleCases
- type SqLogger
- type String
- type StringField
- func (f StringField) As(alias string) StringField
- func (f StringField) Asc() StringField
- func (f StringField) Collate(collation string) StringField
- func (f StringField) Desc() StringField
- func (f StringField) Eq(val String) Predicate
- func (f StringField) EqString(s string) Predicate
- func (f StringField) Ge(val String) Predicate
- func (f StringField) GeString(s string) Predicate
- func (f StringField) GetAlias() string
- func (f StringField) Gt(val String) Predicate
- func (f StringField) GtString(s string) Predicate
- func (f StringField) ILikeString(s string) Predicate
- func (f StringField) In(val any) Predicate
- func (f StringField) IsField()
- func (f StringField) IsNotNull() Predicate
- func (f StringField) IsNull() Predicate
- func (f StringField) IsString()
- func (f StringField) Le(val String) Predicate
- func (f StringField) LeString(s string) Predicate
- func (f StringField) LikeString(s string) Predicate
- func (f StringField) Lt(val String) Predicate
- func (f StringField) LtString(s string) Predicate
- func (f StringField) Ne(val String) Predicate
- func (f StringField) NeString(s string) Predicate
- func (f StringField) NullsFirst() StringField
- func (f StringField) NullsLast() StringField
- func (f StringField) Set(val any) Assignment
- func (f StringField) SetString(s string) Assignment
- func (f StringField) Setf(format string, values ...any) Assignment
- func (f StringField) WithPrefix(prefix string) Field
- func (f StringField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type StringParameter
- type Table
- type TableStruct
- type TableValues
- func (vs TableValues) Field(name string) AnyField
- func (vs TableValues) GetAlias() string
- func (vs TableValues) GetColumns() []string
- func (vs TableValues) GetDialect() string
- func (vs TableValues) GetFetchableFields() []Field
- func (vs TableValues) IsTable()
- func (vs TableValues) SetFetchableFields([]Field) (query Query, ok bool)
- func (vs TableValues) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type Time
- type TimeField
- func (f TimeField) As(alias string) TimeField
- func (f TimeField) Asc() TimeField
- func (f TimeField) Desc() TimeField
- func (f TimeField) Eq(val Time) Predicate
- func (f TimeField) EqTime(t time.Time) Predicate
- func (f TimeField) Ge(val Time) Predicate
- func (f TimeField) GeTime(t time.Time) Predicate
- func (f TimeField) GetAlias() string
- func (f TimeField) Gt(val Time) Predicate
- func (f TimeField) GtTime(t time.Time) Predicate
- func (f TimeField) In(val any) Predicate
- func (f TimeField) IsField()
- func (f TimeField) IsNotNull() Predicate
- func (f TimeField) IsNull() Predicate
- func (f TimeField) IsTime()
- func (f TimeField) Le(val Time) Predicate
- func (f TimeField) LeTime(t time.Time) Predicate
- func (f TimeField) Lt(val Time) Predicate
- func (f TimeField) LtTime(t time.Time) Predicate
- func (f TimeField) Ne(val Time) Predicate
- func (f TimeField) NeTime(t time.Time) Predicate
- func (f TimeField) NullsFirst() TimeField
- func (f TimeField) NullsLast() TimeField
- func (f TimeField) Set(val any) Assignment
- func (f TimeField) SetTime(t time.Time) Assignment
- func (f TimeField) SetTimestamp(t Timestamp) Assignment
- func (f TimeField) Setf(format string, values ...any) Assignment
- func (f TimeField) WithPrefix(prefix string) Field
- func (f TimeField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type TimeParameter
- type Timestamp
- type UUID
- type UUIDField
- func (f UUIDField) As(alias string) UUIDField
- func (f UUIDField) Asc() UUIDField
- func (f UUIDField) Desc() UUIDField
- func (f UUIDField) Eq(val any) Predicate
- func (f UUIDField) EqUUID(val any) Predicate
- func (f UUIDField) GetAlias() string
- func (f UUIDField) In(val any) Predicate
- func (f UUIDField) IsField()
- func (f UUIDField) IsNotNull() Predicate
- func (f UUIDField) IsNull() Predicate
- func (f UUIDField) IsUUID()
- func (f UUIDField) Ne(val any) Predicate
- func (f UUIDField) NeUUID(val any) Predicate
- func (f UUIDField) NullsFirst() UUIDField
- func (f UUIDField) NullsLast() UUIDField
- func (f UUIDField) Set(val any) Assignment
- func (f UUIDField) SetUUID(val any) Assignment
- func (f UUIDField) Setf(format string, values ...any) Assignment
- func (f UUIDField) WithPrefix(prefix string) Field
- func (f UUIDField) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type UpdateQuery
- func (q UpdateQuery) GetDialect() string
- func (q UpdateQuery) GetFetchableFields() []Field
- func (q UpdateQuery) Set(assignments ...Assignment) UpdateQuery
- func (q UpdateQuery) SetDialect(dialect string) UpdateQuery
- func (q UpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
- func (q UpdateQuery) SetFunc(colmapper func(*Column)) UpdateQuery
- func (q UpdateQuery) Where(predicates ...Predicate) UpdateQuery
- func (q UpdateQuery) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) (err error)
- type ValueExpression
- func (e ValueExpression) As(alias string) ValueExpression
- func (e ValueExpression) Eq(val any) Predicate
- func (e ValueExpression) Ge(val any) Predicate
- func (e ValueExpression) GetAlias() string
- func (e ValueExpression) Gt(val any) Predicate
- func (e ValueExpression) In(val any) Predicate
- func (e ValueExpression) IsArray()
- func (e ValueExpression) IsBinary()
- func (e ValueExpression) IsBoolean()
- func (e ValueExpression) IsEnum()
- func (e ValueExpression) IsField()
- func (e ValueExpression) IsJSON()
- func (e ValueExpression) IsNumber()
- func (e ValueExpression) IsString()
- func (e ValueExpression) IsTime()
- func (e ValueExpression) IsUUID()
- func (e ValueExpression) Le(val any) Predicate
- func (e ValueExpression) Lt(val any) Predicate
- func (e ValueExpression) Ne(val any) Predicate
- func (e ValueExpression) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
- type VariadicPredicate
- type VariadicQuery
- type VariadicQueryOperator
- type ViewStruct
- type Window
- type WindowDefinition
- func (w WindowDefinition) Frame(frameSpec string, frameValues ...any) WindowDefinition
- func (w WindowDefinition) IsWindow()
- func (w WindowDefinition) OrderBy(fields ...Field) WindowDefinition
- func (w WindowDefinition) PartitionBy(fields ...Field) WindowDefinition
- func (w WindowDefinition) WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, ...) error
Constants ¶
const ( JoinInner = "JOIN" JoinLeft = "LEFT JOIN" JoinRight = "RIGHT JOIN" JoinFull = "FULL JOIN" JoinCross = "CROSS JOIN" )
Join operators.
const ( DialectSQLite = "sqlite" DialectPostgres = "postgres" DialectMySQL = "mysql" DialectSQLServer = "sqlserver" )
Dialects supported.
Variables ¶
var ( SQLite sqliteQueryBuilder Postgres postgresQueryBuilder MySQL mysqlQueryBuilder SQLServer sqlserverQueryBuilder )
Dialect-specific query builder variables.
Functions ¶
func ArrayValue ¶
ArrayValue takes in a []string, []int64, []int32, []float64, []float32 or []bool and returns a driver.Valuer for that type. For Postgres, it serializes into a Postgres array. Otherwise, it serializes into a JSON array.
func EnumValue ¶
func EnumValue(value Enumeration) driver.Valuer
EnumValue takes in an Enumeration and returns a driver.Valuer which serializes the enum into a string and additionally checks if the enum is valid.
func EscapeQuote ¶
EscapeQuote will escape the relevant quote in a string by doubling up on it (as per SQL rules).
func FetchAllContext ¶
func FetchAllContext[T any](ctx context.Context, db DB, q Query, rowmapper func(*Row) T) ([]T, error)
FetchAllContext is like FetchAll but additionally requires a context.Context.
func FetchExists ¶
FetchExists returns a boolean indicating if running the given Query on the given DB returned any results.
func FetchExistsContext ¶
FetchExistsContext is like FetchExists but additionally requires a context.Context.
func FetchOneContext ¶
FetchOneContext is like FetchOne but additionally requires a context.Context.
func JSONValue ¶
JSONValue takes in an interface{} and returns a driver.Valuer which runs the value through json.Marshal before submitting it to the database.
func New ¶
New instantiates a new table struct with the given alias. Passing in an empty string is equivalent to giving no alias to the table.
func QuoteIdentifier ¶
QuoteIdentifier quotes an identifier if necessary using dialect-specific quoting rules.
func Sprint ¶
Sprint is the equivalent of Sprintf but for converting a single value into its SQL representation.
func Sprintf ¶
Sprintf will interpolate SQL args into a query string containing prepared statement parameters. It returns an error if an argument cannot be properly represented in SQL. This function may be vulnerable to SQL injection and should be used for logging purposes only.
func ToSQL ¶
func ToSQL(dialect string, w SQLWriter, params map[string][]int) (query string, args []any, err error)
ToSQL converts an SQLWriter into a query string and args slice.
The params map is used to hold the mappings between named parameters in the query to the corresponding index in the args slice and is used for rebinding args by their parameter name. If you don't need to track this, you can pass in a nil map.
func ToSQLContext ¶
func ToSQLContext(ctx context.Context, dialect string, w SQLWriter, params map[string][]int) (query string, args []any, err error)
ToSQLContext is like ToSQL but additionally requires a context.Context.
func UUIDValue ¶
UUIDValue takes in a type whose underlying type must be a [16]byte and returns a driver.Valuer.
func VerboseLog ¶
VerboseLog wraps a DB and adds verbose logging to it.
func WriteValue ¶
func WriteValue(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, params map[string][]int, value any) error
WriteValue is the equivalent of Writef but for writing a single value into the Output.
func Writef ¶
func Writef(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, params map[string][]int, format string, values []any) error
Writef is a fmt.Sprintf-style function that will write a format string and values slice into an Output. The only recognized placeholder is '{}'. Placeholders can be anonymous (e.g. {}), ordinal (e.g. {1}, {2}, {3}) or named (e.g. {name}, {email}, {age}).
- Anonymous placeholders refer to successive values in the values slice. Anonymous placeholders are treated like a series of incrementing ordinal placeholders.
- Ordinal placeholders refer to a specific value in the values slice using 1-based indexing.
- Named placeholders refer to their corresponding sql.NamedArg value in the values slice. If there are multiple sql.NamedArg values with the same name, the last one wins.
If a value is an SQLWriter, its WriteSQL method will be called. Else if a value is a slice, it will undergo slice expansion (https://bokwoon.neocities.org/sq.html#value-expansion). Otherwise, the value is added to the query args slice.
Types ¶
type AnyField ¶
type AnyField struct {
// contains filtered or unexported fields
}
AnyField is a catch-all field type that satisfies the Any interface.
func NewAnyField ¶
func NewAnyField(name string, tbl TableStruct) AnyField
NewAnyField returns a new AnyField.
func (AnyField) Asc ¶
Asc returns a new AnyField indicating that it should be ordered in ascending order i.e. 'ORDER BY field ASC'.
func (AnyField) Desc ¶
Desc returns a new AnyField indicating that it should be ordered in descending order i.e. 'ORDER BY field DESC'.
func (AnyField) Expr ¶
func (f AnyField) Expr(format string, values ...any) Expression
Expr returns an expression where the field is prepended to the front of the expression.
func (AnyField) IsBoolean ¶
func (f AnyField) IsBoolean()
IsBoolean implements the Boolean interface.
func (AnyField) NullsFirst ¶
NullsFirst returns a new NumberField indicating that it should be ordered with nulls first i.e. 'ORDER BY field NULLS FIRST'.
func (AnyField) NullsLast ¶
NullsLast returns a new NumberField indicating that it should be ordered with nulls last i.e. 'ORDER BY field NULLS LAST'.
func (AnyField) Set ¶
func (f AnyField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (AnyField) Setf ¶
func (f AnyField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (AnyField) WithPrefix ¶
WithPrefix returns a new Field that with the given prefix.
type ArrayField ¶
type ArrayField struct {
// contains filtered or unexported fields
}
ArrayField represents an SQL array field.
func NewArrayField ¶
func NewArrayField(fieldName string, tableName TableStruct) ArrayField
NewArrayField returns a new ArrayField.
func (ArrayField) As ¶
func (f ArrayField) As(alias string) ArrayField
As returns a new ArrayField with the given alias.
func (ArrayField) GetAlias ¶
func (f ArrayField) GetAlias() string
GetAlias returns the alias of the ArrayField.
func (ArrayField) IsNotNull ¶
func (f ArrayField) IsNotNull() Predicate
IsNull returns a 'field IS NOT NULL' Predicate.
func (ArrayField) IsNull ¶
func (f ArrayField) IsNull() Predicate
IsNull returns a 'field IS NULL' Predicate.
func (ArrayField) Set ¶
func (f ArrayField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (ArrayField) SetArray ¶
func (f ArrayField) SetArray(val any) Assignment
SetArray is like Set but it wraps val with ArrayValue().
func (ArrayField) Setf ¶
func (f ArrayField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (ArrayField) WithPrefix ¶
func (f ArrayField) WithPrefix(prefix string) Field
WithPrefix returns a new Field that with the given prefix.
type Assignment ¶
type Assignment interface { SQLWriter IsAssignment() }
Assignment is an SQL assignment 'field = value'.
func Set ¶
func Set(field Field, value any) Assignment
Set creates a new Assignment assigning the value to a field.
type Assignments ¶
type Assignments []Assignment
Assignments represents a list of Assignments e.g. x = 1, y = 2, z = 3.
type BinaryField ¶
type BinaryField struct {
// contains filtered or unexported fields
}
BinaryField represents an SQL binary field.
func NewBinaryField ¶
func NewBinaryField(fieldName string, tableName TableStruct) BinaryField
NewBinaryField returns a new BinaryField.
func (BinaryField) As ¶
func (f BinaryField) As(alias string) BinaryField
As returns a new BinaryField with the given alias.
func (BinaryField) Asc ¶
func (f BinaryField) Asc() BinaryField
Asc returns a new BinaryField indicating that it should be ordered in ascending order i.e. 'ORDER BY field ASC'.
func (BinaryField) Desc ¶
func (f BinaryField) Desc() BinaryField
Desc returns a new BinaryField indicating that it should be ordered in ascending order i.e. 'ORDER BY field DESC'.
func (BinaryField) Eq ¶
func (f BinaryField) Eq(val Binary) Predicate
Eq returns a 'field = val' Predicate.
func (BinaryField) EqBytes ¶
func (f BinaryField) EqBytes(b []byte) Predicate
EqBytes returns a 'field = b' Predicate.
func (BinaryField) GetAlias ¶
func (f BinaryField) GetAlias() string
GetAlias returns the alias of the BinaryField.
func (BinaryField) In ¶
func (f BinaryField) In(val any) Predicate
In returns a 'field IN (val)' Predicate.
func (BinaryField) IsBinary ¶
func (f BinaryField) IsBinary()
IsBinary implements the Binary interface.
func (BinaryField) IsNotNull ¶
func (f BinaryField) IsNotNull() Predicate
IsNotNull returns a 'field IS NOT NULL' Predicate.
func (BinaryField) IsNull ¶
func (f BinaryField) IsNull() Predicate
IsNull returns a 'field IS NULL' Predicate.
func (BinaryField) Ne ¶
func (f BinaryField) Ne(val Binary) Predicate
Ne returns a 'field <> val' Predicate.
func (BinaryField) NeBytes ¶
func (f BinaryField) NeBytes(b []byte) Predicate
NeBytes returns a 'field <> b' Predicate.
func (BinaryField) NullsFirst ¶
func (f BinaryField) NullsFirst() BinaryField
NullsFirst returns a new BinaryField indicating that it should be ordered with nulls first i.e. 'ORDER BY field NULLS FIRST'.
func (BinaryField) NullsLast ¶
func (f BinaryField) NullsLast() BinaryField
NullsLast returns a new BinaryField indicating that it should be ordered with nulls last i.e. 'ORDER BY field NULLS LAST'.
func (BinaryField) Set ¶
func (f BinaryField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (BinaryField) SetBytes ¶
func (f BinaryField) SetBytes(b []byte) Assignment
SetBytes returns an Assignment assigning a []byte to the field.
func (BinaryField) Setf ¶
func (f BinaryField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (BinaryField) WithPrefix ¶
func (f BinaryField) WithPrefix(prefix string) Field
WithPrefix returns a new Field that with the given prefix.
type BinaryParameter ¶
BinaryParameter functions as an sql.NamedArg, but implements the Binary interface.
func BytesParam ¶
func BytesParam(name string, b []byte) BinaryParameter
BytesParam creates a new BinaryParameter using a []byte value.
func (BinaryParameter) GetAlias ¶
func (p BinaryParameter) GetAlias() string
GetAlias implements the Field interface.
func (BinaryParameter) IsBinary ¶
func (p BinaryParameter) IsBinary()
IsBinary implements the Binary interface.
func (BinaryParameter) IsField ¶
func (p BinaryParameter) IsField()
IsField implements the Field interface.
type BooleanField ¶
type BooleanField struct {
// contains filtered or unexported fields
}
BooleanField represents an SQL boolean field.
func NewBooleanField ¶
func NewBooleanField(fieldName string, tableName TableStruct) BooleanField
NewBooleanField returns a new BooleanField.
func (BooleanField) As ¶
func (f BooleanField) As(alias string) BooleanField
As returns a new BooleanField with the given alias.
func (BooleanField) Asc ¶
func (f BooleanField) Asc() BooleanField
Asc returns a new BooleanField indicating that it should be ordered in ascending order i.e. 'ORDER BY field ASC'.
func (BooleanField) Desc ¶
func (f BooleanField) Desc() BooleanField
Desc returns a new BooleanField indicating that it should be ordered in descending order i.e. 'ORDER BY field DESC'.
func (BooleanField) Eq ¶
func (f BooleanField) Eq(val Boolean) Predicate
Eq returns a 'field = val' Predicate.
func (BooleanField) EqBool ¶
func (f BooleanField) EqBool(b bool) Predicate
EqBool returns a 'field = b' Predicate.
func (BooleanField) GetAlias ¶
func (f BooleanField) GetAlias() string
GetAlias returns the alias of the BooleanField.
func (BooleanField) IsBoolean ¶
func (f BooleanField) IsBoolean()
IsBoolean implements the Boolean interface.
func (BooleanField) IsField ¶
func (f BooleanField) IsField()
IsField implements the Field interface.
func (BooleanField) IsNotNull ¶
func (f BooleanField) IsNotNull() Predicate
IsNotNull returns a 'field IS NOT NULL' Predicate.
func (BooleanField) IsNull ¶
func (f BooleanField) IsNull() Predicate
IsNull returns a 'field IS NULL' Predicate.
func (BooleanField) Ne ¶
func (f BooleanField) Ne(val Boolean) Predicate
Ne returns a 'field <> val' Predicate.
func (BooleanField) NeBool ¶
func (f BooleanField) NeBool(b bool) Predicate
NeBool returns a 'field <> b' Predicate.
func (BooleanField) NullsFirst ¶
func (f BooleanField) NullsFirst() BooleanField
NullsFirst returns a new BooleanField indicating that it should be ordered with nulls first i.e. 'ORDER BY field NULLS FIRST'.
func (BooleanField) NullsLast ¶
func (f BooleanField) NullsLast() BooleanField
NullsLast returns a new BooleanField indicating that it should be ordered with nulls last i.e. 'ORDER BY field NULLS LAST'.
func (BooleanField) Set ¶
func (f BooleanField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (BooleanField) SetBool ¶
func (f BooleanField) SetBool(b bool) Assignment
SetBool returns an Assignment assigning a bool to the field i.e. 'field = b'.
func (BooleanField) Setf ¶
func (f BooleanField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (BooleanField) WithPrefix ¶
func (f BooleanField) WithPrefix(prefix string) Field
WithPrefix returns a new Field that with the given prefix.
type BooleanParameter ¶
BooleanParameter functions as an sql.NamedArg, but implements the Boolean interface.
func BoolParam ¶
func BoolParam(name string, b bool) BooleanParameter
BoolParam creates a new BooleanParameter from a bool value.
func (BooleanParameter) GetAlias ¶
func (p BooleanParameter) GetAlias() string
GetAlias implements the Field interface.
func (BooleanParameter) IsBoolean ¶
func (p BooleanParameter) IsBoolean()
IsBoolean implements the Boolean interface.
func (BooleanParameter) IsField ¶
func (p BooleanParameter) IsField()
IsField implements the Field interface.
type CTE ¶
type CTE struct {
// contains filtered or unexported fields
}
CTE represents an SQL common table expression (CTE).
func NewRecursiveCTE ¶
NewRecursiveCTE creates a new recursive CTE.
func (CTE) Materialized ¶
Materialized returns a new CTE marked as MATERIALIZED. This only works on postgres.
func (CTE) NotMaterialized ¶
Materialized returns a new CTE marked as NOT MATERIALIZED. This only works on postgres.
type CaseExpression ¶
type CaseExpression struct { Cases PredicateCases Default any // contains filtered or unexported fields }
CaseExpression represents an SQL CASE expression.
func CaseWhen ¶
func CaseWhen(predicate Predicate, result any) CaseExpression
CaseWhen returns a new CaseExpression.
func (CaseExpression) As ¶
func (e CaseExpression) As(alias string) CaseExpression
As returns a new CaseExpression with the given alias.
func (CaseExpression) Else ¶
func (e CaseExpression) Else(fallback any) CaseExpression
Else sets the fallback result of the CaseExpression.
func (CaseExpression) GetAlias ¶
func (e CaseExpression) GetAlias() string
GetAlias returns the alias of the CaseExpression.
func (CaseExpression) IsArray ¶
func (e CaseExpression) IsArray()
IsArray implements the Array interface.
func (CaseExpression) IsBinary ¶
func (e CaseExpression) IsBinary()
IsBinary implements the Binary interface.
func (CaseExpression) IsBoolean ¶
func (e CaseExpression) IsBoolean()
IsBoolean implements the Boolean interface.
func (CaseExpression) IsEnum ¶
func (e CaseExpression) IsEnum()
IsEnum implements the Enum interface.
func (CaseExpression) IsField ¶
func (e CaseExpression) IsField()
IsField implements the Field interface.
func (CaseExpression) IsJSON ¶
func (e CaseExpression) IsJSON()
IsJSON implements the JSON interface.
func (CaseExpression) IsNumber ¶
func (e CaseExpression) IsNumber()
IsNumber implements the Number interface.
func (CaseExpression) IsString ¶
func (e CaseExpression) IsString()
IsString implements the String interface.
func (CaseExpression) IsTime ¶
func (e CaseExpression) IsTime()
IsTime implements the Time interface.
func (CaseExpression) IsUUID ¶
func (e CaseExpression) IsUUID()
IsUUID implements the UUID interface.
func (CaseExpression) When ¶
func (e CaseExpression) When(predicate Predicate, result any) CaseExpression
When adds a new predicate-result pair to the CaseExpression.
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
Column keeps track of what the values mapped to what Field in an InsertQuery or SelectQuery.
func (*Column) SetArray ¶
SetArray maps the array value to the field, wrapped with the ArrayValue() constructor.
func (*Column) SetEnum ¶
func (col *Column) SetEnum(field Enum, value Enumeration)
SetEnum maps the enum value to the field, wrapped with the EnumValue() constructor.
func (*Column) SetFloat64 ¶
SetFloat64 maps the float64 value to the field.
func (*Column) SetJSON ¶
SetJSON maps the JSON value to the field, wrapped with the JSONValue() constructor.
type CompiledExec ¶
type CompiledExec struct {
// contains filtered or unexported fields
}
CompiledExec is the result of compiling a Query down into a query string and args slice. A CompiledExec can be safely executed in parallel.
func CompileExec ¶
func CompileExec(q Query) (*CompiledExec, error)
CompileExec returns a new CompiledExec.
func CompileExecContext ¶
func CompileExecContext(ctx context.Context, q Query) (*CompiledExec, error)
CompileExecContext is like CompileExec but additionally requires a context.Context.
func NewCompiledExec ¶
func NewCompiledExec(dialect string, query string, args []any, params map[string][]int) *CompiledExec
NewCompiledExec returns a new CompiledExec.
func (*CompiledExec) Exec ¶
func (e *CompiledExec) Exec(db DB, params Params) (Result, error)
Exec executes the CompiledExec on the given DB with the given params.
func (*CompiledExec) ExecContext ¶
ExecContext is like Exec but additionally requires a context.Context.
func (*CompiledExec) Prepare ¶
func (e *CompiledExec) Prepare(db DB) (*PreparedExec, error)
Prepare creates a PreparedExec from a CompiledExec by preparing it on the given DB.
func (*CompiledExec) PrepareContext ¶
func (e *CompiledExec) PrepareContext(ctx context.Context, db DB) (*PreparedExec, error)
PrepareContext is like Prepare but additionally requires a context.Context.
type CompiledFetch ¶
type CompiledFetch[T any] struct { // contains filtered or unexported fields }
CompiledFetch is the result of compiling a Query down into a query string and args slice. A CompiledFetch can be safely executed in parallel.
func CompileFetch ¶
func CompileFetch[T any](q Query, rowmapper func(*Row) T) (*CompiledFetch[T], error)
CompileFetch returns a new CompileFetch.
func CompileFetchContext ¶
func CompileFetchContext[T any](ctx context.Context, q Query, rowmapper func(*Row) T) (f *CompiledFetch[T], err error)
CompileFetchContext is like CompileFetch but accpets a context.Context.
func NewCompiledFetch ¶
func NewCompiledFetch[T any](dialect string, query string, args []any, params map[string][]int, rowmapper func(*Row) T) *CompiledFetch[T]
NewCompiledFetch returns a new CompiledFetch.
func (*CompiledFetch[T]) FetchAll ¶
func (f *CompiledFetch[T]) FetchAll(db DB, params Params) ([]T, error)
FetchAll returns all the results from running the CompiledFetch on the given DB with the give params.
func (*CompiledFetch[T]) FetchAllContext ¶
FetchAllContext is like FetchAll but additionally requires a context.Context.
func (*CompiledFetch[T]) FetchCursor ¶
func (f *CompiledFetch[T]) FetchCursor(db DB, params Params) (*Cursor[T], error)
FetchCursor returns a new cursor.
func (*CompiledFetch[T]) FetchCursorContext ¶
func (f *CompiledFetch[T]) FetchCursorContext(ctx context.Context, db DB, params Params) (*Cursor[T], error)
FetchCursorContext is like FetchCursor but additionally requires a context.Context.
func (*CompiledFetch[T]) FetchOne ¶
func (f *CompiledFetch[T]) FetchOne(db DB, params Params) (T, error)
FetchOne returns the first result from running the CompiledFetch on the given DB with the give params.
func (*CompiledFetch[T]) FetchOneContext ¶
FetchOneContext is like FetchOne but additionally requires a context.Context.
func (*CompiledFetch[T]) GetSQL ¶
func (f *CompiledFetch[T]) GetSQL() (dialect string, query string, args []any, params map[string][]int, rowmapper func(*Row) T)
GetSQL returns a copy of the dialect, query, args, params and rowmapper that make up the CompiledFetch.
func (*CompiledFetch[T]) Prepare ¶
func (f *CompiledFetch[T]) Prepare(db DB) (*PreparedFetch[T], error)
Prepare creates a PreparedFetch from a CompiledFetch by preparing it on the given DB.
func (*CompiledFetch[T]) PrepareContext ¶
func (f *CompiledFetch[T]) PrepareContext(ctx context.Context, db DB) (*PreparedFetch[T], error)
PrepareContext is like Prepare but additionally requires a context.Context.
type ConflictClause ¶
type ConflictClause struct { ConstraintName string Fields []Field Predicate Predicate DoNothing bool Resolution []Assignment ResolutionPredicate Predicate }
ConflictClause represents an SQL conflict clause e.g. ON CONFLICT DO NOTHING/DO UPDATE or ON DUPLICATE KEY UPDATE.
type Cursor ¶
type Cursor[T any] struct { // contains filtered or unexported fields }
A Cursor represents a database cursor.
func FetchCursor ¶
FetchCursor returns a new cursor.
func FetchCursorContext ¶
func FetchCursorContext[T any](ctx context.Context, db DB, q Query, rowmapper func(*Row) T) (*Cursor[T], error)
FetchCursorContext is like FetchCursor but additionally requires a context.Context.
type CustomQuery ¶
type CustomQuery struct {
// contains filtered or unexported fields
}
CustomQuery represents a user-defined query.
func Queryf ¶
func Queryf(format string, values ...any) CustomQuery
Queryf creates a new query using Writef syntax.
func (CustomQuery) Append ¶ added in v0.2.7
func (q CustomQuery) Append(format string, values ...any) CustomQuery
Append returns a new CustomQuery with the format string and values slice appended to the current CustomQuery.
func (CustomQuery) GetDialect ¶
func (q CustomQuery) GetDialect() string
GetDialect gets the dialect of the query.
func (CustomQuery) GetFetchableFields ¶
func (q CustomQuery) GetFetchableFields() []Field
GetFetchableFields gets the fetchable fields of the query.
func (CustomQuery) SetDialect ¶
func (q CustomQuery) SetDialect(dialect string) CustomQuery
SetDialect sets the dialect of the query.
func (CustomQuery) SetFetchableFields ¶
func (q CustomQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields sets the fetchable fields of the query.
type DB ¶
type DB interface { QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) }
DB is a database/sql abstraction that can query the database. *sql.Conn, *sql.DB and *sql.Tx all implement DB.
type DeleteQuery ¶
type DeleteQuery struct { Dialect string // WITH CTEs []CTE // DELETE FROM DeleteTable Table DeleteTables []Table // USING UsingTable Table JoinTables []JoinTable // WHERE WherePredicate Predicate // ORDER BY OrderByFields Fields // LIMIT LimitRows any // OFFSET OffsetRows any // RETURNING ReturningFields []Field }
DeleteQuery represents an SQL DELETE query.
func (DeleteQuery) GetDialect ¶
func (q DeleteQuery) GetDialect() string
GetDialect implements the Query interface.
func (DeleteQuery) GetFetchableFields ¶
func (q DeleteQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (DeleteQuery) SetDialect ¶
func (q DeleteQuery) SetDialect(dialect string) DeleteQuery
SetDialect sets the dialect of the query.
func (DeleteQuery) SetFetchableFields ¶
func (q DeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (DeleteQuery) Where ¶
func (q DeleteQuery) Where(predicates ...Predicate) DeleteQuery
Where appends to the WherePredicate field of the DeleteQuery.
type DialectCase ¶
DialectCase holds the result to be used for a given dialect in a DialectExpression.
type DialectExpression ¶
type DialectExpression struct { Default any Cases DialectCases }
DialectExpression represents an SQL expression that renders differently depending on the dialect.
func DialectExpr ¶
func DialectExpr(format string, values ...any) DialectExpression
DialectExpr returns a new DialectExpression. The expression passed in is used as the default.
func DialectValue ¶
func DialectValue(value any) DialectExpression
DialectValue returns a new DialectExpression. The value passed in is used as the default.
func (DialectExpression) DialectExpr ¶
func (e DialectExpression) DialectExpr(dialect string, format string, values ...any) DialectExpression
DialectExpr adds a new dialect-expression pair to the DialectExpression.
func (DialectExpression) DialectValue ¶
func (e DialectExpression) DialectValue(dialect string, value any) DialectExpression
DialectValue adds a new dialect-value pair to the DialectExpression.
func (DialectExpression) IsArray ¶
func (e DialectExpression) IsArray()
IsArray implements the Array interface.
func (DialectExpression) IsBinary ¶
func (e DialectExpression) IsBinary()
IsBinary implements the Binary interface.
func (DialectExpression) IsBoolean ¶
func (e DialectExpression) IsBoolean()
IsBoolean implements the Boolean interface.
func (DialectExpression) IsEnum ¶
func (e DialectExpression) IsEnum()
IsEnum implements the Enum interface.
func (DialectExpression) IsField ¶
func (e DialectExpression) IsField()
IsField implements the Field interface.
func (DialectExpression) IsJSON ¶
func (e DialectExpression) IsJSON()
IsJSON implements the JSON interface.
func (DialectExpression) IsNumber ¶
func (e DialectExpression) IsNumber()
IsNumber implements the Number interface.
func (DialectExpression) IsString ¶
func (e DialectExpression) IsString()
IsString implements the String interface.
func (DialectExpression) IsTable ¶
func (e DialectExpression) IsTable()
IsTable implements the Table interface.
func (DialectExpression) IsTime ¶
func (e DialectExpression) IsTime()
IsTime implements the Time interface.
func (DialectExpression) IsUUID ¶
func (e DialectExpression) IsUUID()
IsUUID implements the UUID interface.
type DialectValuer ¶
DialectValuer is any type that will yield a different driver.Valuer depending on the SQL dialect.
type EnumField ¶
type EnumField struct {
// contains filtered or unexported fields
}
EnumField represents an SQL enum field.
func NewEnumField ¶
func NewEnumField(name string, tbl TableStruct) EnumField
NewEnumField returns a new EnumField.
func (EnumField) Eq ¶
Eq returns a 'field = val' Predicate. The value is passed as-is to the database. If the value is an Enumeration type, you should be using EqEnum instead.
func (EnumField) EqEnum ¶ added in v0.2.1
func (f EnumField) EqEnum(val Enumeration) Predicate
EqEnum is like Eq but it wraps val with EnumValue().
func (EnumField) Ne ¶
Ne returns a 'field <> val' Predicate. The value is passed as-is to the database. If the value is an Enumeration type, you should be using NeEnum instead.
func (EnumField) NeEnum ¶ added in v0.2.1
func (f EnumField) NeEnum(val Enumeration) Predicate
NeEnum is like Ne but it wraps val with EnumValue().
func (EnumField) Set ¶
func (f EnumField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (EnumField) SetEnum ¶
func (f EnumField) SetEnum(val Enumeration) Assignment
SetEnum is like Set but wraps val with EnumValue().
func (EnumField) Setf ¶
func (f EnumField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (EnumField) WithPrefix ¶
WithPrefix returns a new Field that with the given prefix.
type Enumeration ¶
type Enumeration interface { // Enumerate returns the names of all valid enum values. // // If the enum is backed by a string, each string in the slice is the // corresponding enum's string value. // // If the enum is backed by an int, each int index in the slice is the // corresponding enum's int value and the string is the enum's name. Enums // with empty string names are considered invalid, unless it is the very // first enum (at index 0). Enumerate() []string }
Enumeration represents a Go enum.
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression is an SQL expression that satisfies the Table, Field, Predicate, Binary, Boolean, Number, String and Time interfaces.
func AvgOver ¶
func AvgOver(num Number, window Window) Expression
AvgOver represents the AVG(<num>) OVER (<window>) window function.
func CountOver ¶
func CountOver(field Field, window Window) Expression
CountOver represents the COUNT(<field>) OVER (<window>) window function.
func CountStarOver ¶
func CountStarOver(window Window) Expression
CountStarOver represents the COUNT(*) OVER (<window>) window function.
func CumeDistOver ¶
func CumeDistOver(window Window) Expression
CumeDistOver represents the CUME_DIST() OVER (<window>) window function.
func DenseRankOver ¶
func DenseRankOver(window Window) Expression
DenseRankOver represents the DENSE_RANK() OVER (<window>) window function.
func Expr ¶
func Expr(format string, values ...any) Expression
Expr creates a new Expression using Writef syntax.
func FirstValueOver ¶
func FirstValueOver(field Field, window Window) Expression
FirstValueOver represents the FIRST_VALUE(<field>) OVER (<window>) window function.
func LastValueOver ¶
func LastValueOver(field Field, window Window) Expression
LastValueOver represents the LAST_VALUE(<field>) OVER (<window>) window function.
func MaxOver ¶
func MaxOver(field Field, window Window) Expression
MaxOver represents the MAX(<field>) OVER (<window>) window function.
func MinOver ¶
func MinOver(field Field, window Window) Expression
MinOver represents the MIN(<field>) OVER (<window>) window function.
func RankOver ¶
func RankOver(window Window) Expression
RankOver represents the RANK() OVER (<window>) window function.
func RowNumberOver ¶
func RowNumberOver(window Window) Expression
RowNumberOver represents the ROW_NUMBER() OVER (<window>) window function.
func SumOver ¶
func SumOver(num Number, window Window) Expression
SumOver represents the SUM(<num>) OVER (<window>) window function.
func (Expression) As ¶
func (e Expression) As(alias string) Expression
As returns a new Expression with the given alias.
func (Expression) Eq ¶
func (e Expression) Eq(val any) Predicate
Eq returns an 'expr = val' Predicate.
func (Expression) Ge ¶
func (e Expression) Ge(val any) Predicate
Ge returns an 'expr >= val' Predicate.
func (Expression) GetAlias ¶
func (e Expression) GetAlias() string
GetAlias returns the alias of the Expression.
func (Expression) Gt ¶
func (e Expression) Gt(val any) Predicate
Gt returns an 'expr > val' Predicate.
func (Expression) In ¶
func (e Expression) In(val any) Predicate
In returns an 'expr IN (val)' Predicate.
func (Expression) IsArray ¶
func (e Expression) IsArray()
AssertArray implements the Array interface.
func (Expression) IsAssignment ¶
func (e Expression) IsAssignment()
func (Expression) IsBinary ¶
func (e Expression) IsBinary()
AssertBinary implements the Binary interface.
func (Expression) IsBoolean ¶
func (e Expression) IsBoolean()
AssertBoolean implements the Boolean interface.
func (Expression) IsField ¶
func (e Expression) IsField()
AssertField implements the Field interface.
func (Expression) IsNumber ¶
func (e Expression) IsNumber()
AssertNumber implements the Number interface.
func (Expression) IsString ¶
func (e Expression) IsString()
AssertString implements the String interface.
func (Expression) IsTable ¶
func (e Expression) IsTable()
AssertTable implements the Table interface.
func (Expression) IsUUID ¶
func (e Expression) IsUUID()
AssertUUIDType implements the UUID interface.
func (Expression) Le ¶
func (e Expression) Le(val any) Predicate
Le returns an 'expr <= val' Predicate.
func (Expression) Lt ¶
func (e Expression) Lt(val any) Predicate
Lt returns an 'expr < val' Predicate.
func (Expression) Ne ¶
func (e Expression) Ne(val any) Predicate
Ne returns an 'expr <> val' Predicate.
type Field ¶
type Field interface { SQLWriter IsField() }
Field is either a table column or some SQL expression.
type Fields ¶
type Fields []Field
Fields represents a list of Fields e.g. tbl.field1, tbl.field2, tbl.field3.
type Identifier ¶
type Identifier string
Identifier represents an SQL identifier. If necessary, it will be quoted according to the dialect.
type InsertQuery ¶
type InsertQuery struct { Dialect string ColumnMapper func(*Column) // WITH CTEs []CTE // INSERT INTO InsertIgnore bool InsertTable Table InsertColumns []Field // VALUES RowValues []RowValue RowAlias string // SELECT SelectQuery Query // ON CONFLICT Conflict ConflictClause // RETURNING ReturningFields []Field }
InsertQuery represents an SQL INSERT query.
func (InsertQuery) ColumnValues ¶
func (q InsertQuery) ColumnValues(colmapper func(*Column)) InsertQuery
ColumnValues sets the ColumnMapper field of the InsertQuery.
func (InsertQuery) Columns ¶
func (q InsertQuery) Columns(fields ...Field) InsertQuery
Columns sets the InsertColumns field of the InsertQuery.
func (InsertQuery) GetDialect ¶
func (q InsertQuery) GetDialect() string
GetDialect implements the Query interface.
func (InsertQuery) GetFetchableFields ¶
func (q InsertQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (InsertQuery) Select ¶
func (q InsertQuery) Select(query Query) InsertQuery
Select sets the SelectQuery field of the InsertQuery.
func (InsertQuery) SetDialect ¶
func (q InsertQuery) SetDialect(dialect string) InsertQuery
SetDialect sets the dialect of the query.
func (InsertQuery) SetFetchableFields ¶
func (q InsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (InsertQuery) Values ¶
func (q InsertQuery) Values(values ...any) InsertQuery
Values sets the RowValues field of the InsertQuery.
type JSONField ¶
type JSONField struct {
// contains filtered or unexported fields
}
JSONField represents an SQL JSON field.
func NewJSONField ¶
func NewJSONField(name string, tbl TableStruct) JSONField
NewJSONField returns a new JSONField.
func (JSONField) IsBinary ¶ added in v0.2.2
func (f JSONField) IsBinary()
IsBinary implements the Binary interface.
func (JSONField) IsString ¶ added in v0.2.2
func (f JSONField) IsString()
IsString implements the String interface.
func (JSONField) Set ¶
func (f JSONField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (JSONField) SetJSON ¶
func (f JSONField) SetJSON(val any) Assignment
SetJSON is like Set but it wraps val with JSONValue().
func (JSONField) Setf ¶
func (f JSONField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (JSONField) WithPrefix ¶
WithPrefix returns a new Field that with the given prefix.
type JoinTable ¶
JoinTable represents a join on a table.
func CustomJoin ¶
CustomJoin creates a new JoinTable with the a custom join operator.
type LiteralValue ¶
type LiteralValue struct {
// contains filtered or unexported fields
}
LiteralValue represents an SQL value literally interpolated into the query. Doing so potentially exposes the query to SQL injection so only do this for values that you trust e.g. literals and constants.
func (LiteralValue) As ¶
func (v LiteralValue) As(alias string) LiteralValue
As returns a new LiteralValue with the given alias.
func (LiteralValue) Eq ¶
func (v LiteralValue) Eq(val any) Predicate
Eq returns a 'literal = val' Predicate.
func (LiteralValue) Ge ¶
func (v LiteralValue) Ge(val any) Predicate
Ge returns a 'literal >= val' Predicate.
func (LiteralValue) GetAlias ¶
func (v LiteralValue) GetAlias() string
GetAlias returns the alias of the LiteralValue.
func (LiteralValue) Gt ¶
func (v LiteralValue) Gt(val any) Predicate
Gt returns a 'literal > val' Predicate.
func (LiteralValue) In ¶
func (v LiteralValue) In(val any) Predicate
In returns a 'literal IN (val)' Predicate.
func (LiteralValue) IsBinary ¶
func (v LiteralValue) IsBinary()
IsBinary implements the Binary interface.
func (LiteralValue) IsBoolean ¶
func (v LiteralValue) IsBoolean()
IsBoolean implements the Boolean interface.
func (LiteralValue) IsField ¶
func (v LiteralValue) IsField()
IsField implements the Field interface.
func (LiteralValue) IsNumber ¶
func (v LiteralValue) IsNumber()
IsNumber implements the Number interface.
func (LiteralValue) IsString ¶
func (v LiteralValue) IsString()
IsString implements the String interface.
func (LiteralValue) Le ¶
func (v LiteralValue) Le(val any) Predicate
Le returns a 'literal <= val' Predicate.
func (LiteralValue) Lt ¶
func (v LiteralValue) Lt(val any) Predicate
Lt returns a 'literal < val' Predicate.
func (LiteralValue) Ne ¶
func (v LiteralValue) Ne(val any) Predicate
Ne returns a 'literal <> val' Predicate.
type LogSettings ¶
type LogSettings struct { LogAsynchronously bool IncludeTime bool IncludeCaller bool IncludeResults int }
LogSettings are the various log settings taken into account when producing the QueryStats.
type LoggerConfig ¶
type LoggerConfig struct { LogAsynchronously bool ShowTimeTaken bool ShowCaller bool ShowResults int NoColor bool InterpolateVerbose bool HideArgs bool }
LoggerConfig is the config used for the sq logger.
type MySQLDeleteQuery ¶
type MySQLDeleteQuery DeleteQuery
MySQLDeleteQuery represents a MySQL DELETE query.
func (MySQLDeleteQuery) CrossJoin ¶
func (q MySQLDeleteQuery) CrossJoin(table Table) MySQLDeleteQuery
CrossJoin cross joins a new Table to the MySQLDeleteQuery.
func (MySQLDeleteQuery) CustomJoin ¶
func (q MySQLDeleteQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) MySQLDeleteQuery
CustomJoin joins a new Table to the MySQLDeleteQuery with a custom join operator.
func (MySQLDeleteQuery) From ¶
func (q MySQLDeleteQuery) From(table Table) MySQLDeleteQuery
From sets the UsingTable of the MySQLDeleteQuery.
func (MySQLDeleteQuery) FullJoin ¶
func (q MySQLDeleteQuery) FullJoin(table Table, predicates ...Predicate) MySQLDeleteQuery
FullJoin full joins a new Table to the MySQLDeleteQuery.
func (MySQLDeleteQuery) GetDialect ¶
func (q MySQLDeleteQuery) GetDialect() string
GetDialect implements the Query interface.
func (MySQLDeleteQuery) GetFetchableFields ¶
func (q MySQLDeleteQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (MySQLDeleteQuery) Join ¶
func (q MySQLDeleteQuery) Join(table Table, predicates ...Predicate) MySQLDeleteQuery
Join joins a new Table to the MySQLDeleteQuery.
func (MySQLDeleteQuery) JoinUsing ¶
func (q MySQLDeleteQuery) JoinUsing(table Table, fields ...Field) MySQLDeleteQuery
JoinUsing joins a new Table to the MySQLDeleteQuery with the USING operator.
func (MySQLDeleteQuery) LeftJoin ¶
func (q MySQLDeleteQuery) LeftJoin(table Table, predicates ...Predicate) MySQLDeleteQuery
LeftJoin left joins a new Table to the MySQLDeleteQuery.
func (MySQLDeleteQuery) Limit ¶
func (q MySQLDeleteQuery) Limit(limit any) MySQLDeleteQuery
Limit sets the LimitRows field of the MySQLDeleteQuery.
func (MySQLDeleteQuery) OrderBy ¶
func (q MySQLDeleteQuery) OrderBy(fields ...Field) MySQLDeleteQuery
OrderBy sets the OrderByFields field of the MySQLDeleteQuery.
func (MySQLDeleteQuery) SetDialect ¶
func (q MySQLDeleteQuery) SetDialect(dialect string) MySQLDeleteQuery
SetDialect sets the dialect of the query.
func (MySQLDeleteQuery) SetFetchableFields ¶
func (q MySQLDeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (MySQLDeleteQuery) Where ¶
func (q MySQLDeleteQuery) Where(predicates ...Predicate) MySQLDeleteQuery
Where appends to the WherePredicate field of the MySQLDeleteQuery.
type MySQLInsertQuery ¶
type MySQLInsertQuery InsertQuery
MySQLInsertQuery represents a MySQL INSERT query.
func (MySQLInsertQuery) As ¶
func (q MySQLInsertQuery) As(rowAlias string) MySQLInsertQuery
As sets the RowAlias field of the MySQLInsertQuery.
func (MySQLInsertQuery) ColumnValues ¶
func (q MySQLInsertQuery) ColumnValues(colmapper func(*Column)) MySQLInsertQuery
ColumnValues sets the ColumnMapper field of the MySQLInsertQuery.
func (MySQLInsertQuery) Columns ¶
func (q MySQLInsertQuery) Columns(fields ...Field) MySQLInsertQuery
Columns sets the InsertColumns field of the MySQLInsertQuery.
func (MySQLInsertQuery) GetDialect ¶
func (q MySQLInsertQuery) GetDialect() string
GetDialect implements the Query interface.
func (MySQLInsertQuery) GetFetchableFields ¶
func (q MySQLInsertQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (MySQLInsertQuery) OnDuplicateKeyUpdate ¶
func (q MySQLInsertQuery) OnDuplicateKeyUpdate(assignments ...Assignment) MySQLInsertQuery
OnDuplicateKeyUpdate sets the ON DUPLICATE KEY UPDATE clause of the MySQLInsertQuery.
func (MySQLInsertQuery) Select ¶
func (q MySQLInsertQuery) Select(query Query) MySQLInsertQuery
Select sets the SelectQuery field of the MySQLInsertQuery.
func (MySQLInsertQuery) SetDialect ¶
func (q MySQLInsertQuery) SetDialect(dialect string) MySQLInsertQuery
SetDialect returns the dialect of the query.
func (MySQLInsertQuery) SetFetchableFields ¶
func (q MySQLInsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (MySQLInsertQuery) Values ¶
func (q MySQLInsertQuery) Values(values ...any) MySQLInsertQuery
Values sets the RowValues field of the MySQLInsertQuery.
type MySQLSelectQuery ¶
type MySQLSelectQuery SelectQuery
MySQLSelectQuery represents a MySQL SELECT query.
func (MySQLSelectQuery) As ¶
func (q MySQLSelectQuery) As(alias string, columns ...string) MySQLSelectQuery
As returns a new MySQLSelectQuery with the table alias (and optionally column aliases).
func (MySQLSelectQuery) CrossJoin ¶
func (q MySQLSelectQuery) CrossJoin(table Table) MySQLSelectQuery
CrossJoin cross joins a new Table to the MySQLSelectQuery.
func (MySQLSelectQuery) CustomJoin ¶
func (q MySQLSelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) MySQLSelectQuery
CustomJoin joins a new Table to the MySQLSelectQuery with a custom join operator.
func (MySQLSelectQuery) Field ¶
func (q MySQLSelectQuery) Field(name string) AnyField
Field returns a new field qualified by the MySQLSelectQuery's alias.
func (MySQLSelectQuery) From ¶
func (q MySQLSelectQuery) From(table Table) MySQLSelectQuery
From sets the FromTable field in the MySQLSelectQuery.
func (MySQLSelectQuery) FullJoin ¶
func (q MySQLSelectQuery) FullJoin(table Table, predicates ...Predicate) MySQLSelectQuery
FullJoin full joins a new Table to the MySQLSelectQuery.
func (MySQLSelectQuery) GetAlias ¶
func (q MySQLSelectQuery) GetAlias() string
GetAlias returns the alias of the MySQLSelectQuery.
func (MySQLSelectQuery) GetDialect ¶
func (q MySQLSelectQuery) GetDialect() string
GetDialect implements the Query interface.
func (MySQLSelectQuery) GetFetchableFields ¶
func (q MySQLSelectQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (MySQLSelectQuery) GroupBy ¶
func (q MySQLSelectQuery) GroupBy(fields ...Field) MySQLSelectQuery
GroupBy appends to the GroupByFields field in the MySQLSelectQuery.
func (MySQLSelectQuery) Having ¶
func (q MySQLSelectQuery) Having(predicates ...Predicate) MySQLSelectQuery
Having appends to the HavingPredicate field in the MySQLSelectQuery.
func (MySQLSelectQuery) IsArray ¶
func (q MySQLSelectQuery) IsArray()
IsArray implements the Array interface.
func (MySQLSelectQuery) IsBinary ¶
func (q MySQLSelectQuery) IsBinary()
IsBinary implements the Binary interface.
func (MySQLSelectQuery) IsBoolean ¶
func (q MySQLSelectQuery) IsBoolean()
IsBoolean implements the Boolean interface.
func (MySQLSelectQuery) IsEnum ¶
func (q MySQLSelectQuery) IsEnum()
IsEnum implements the Enum interface.
func (MySQLSelectQuery) IsField ¶
func (q MySQLSelectQuery) IsField()
IsField implements the Field interface.
func (MySQLSelectQuery) IsJSON ¶
func (q MySQLSelectQuery) IsJSON()
IsJSON implements the JSON interface.
func (MySQLSelectQuery) IsNumber ¶
func (q MySQLSelectQuery) IsNumber()
IsNumber implements the Number interface.
func (MySQLSelectQuery) IsString ¶
func (q MySQLSelectQuery) IsString()
IsString implements the String interface.
func (MySQLSelectQuery) IsTable ¶
func (q MySQLSelectQuery) IsTable()
IsTable implements the Table interface.
func (MySQLSelectQuery) IsTime ¶
func (q MySQLSelectQuery) IsTime()
IsTime implements the Time interface.
func (MySQLSelectQuery) IsUUID ¶
func (q MySQLSelectQuery) IsUUID()
IsUUID implements the UUID interface.
func (MySQLSelectQuery) Join ¶
func (q MySQLSelectQuery) Join(table Table, predicates ...Predicate) MySQLSelectQuery
Join joins a new Table to the MySQLSelectQuery.
func (MySQLSelectQuery) JoinUsing ¶
func (q MySQLSelectQuery) JoinUsing(table Table, fields ...Field) MySQLSelectQuery
JoinUsing joins a new Table to the MySQLSelectQuery with the USING operator.
func (MySQLSelectQuery) LeftJoin ¶
func (q MySQLSelectQuery) LeftJoin(table Table, predicates ...Predicate) MySQLSelectQuery
LeftJoin left joins a new Table to the MySQLSelectQuery.
func (MySQLSelectQuery) Limit ¶
func (q MySQLSelectQuery) Limit(limit any) MySQLSelectQuery
Limit sets the LimitRows field in the MySQLSelectQuery.
func (MySQLSelectQuery) LockRows ¶
func (q MySQLSelectQuery) LockRows(lockClause string, lockValues ...any) MySQLSelectQuery
LockRows sets the lock clause of the MySQLSelectQuery.
func (MySQLSelectQuery) Offset ¶
func (q MySQLSelectQuery) Offset(offset any) MySQLSelectQuery
Offset sets the OffsetRows field in the MySQLSelectQuery.
func (MySQLSelectQuery) OrderBy ¶
func (q MySQLSelectQuery) OrderBy(fields ...Field) MySQLSelectQuery
OrderBy appends to the OrderByFields field in the MySQLSelectQuery.
func (MySQLSelectQuery) Select ¶
func (q MySQLSelectQuery) Select(fields ...Field) MySQLSelectQuery
Select appends to the SelectFields in the MySQLSelectQuery.
func (MySQLSelectQuery) SelectDistinct ¶
func (q MySQLSelectQuery) SelectDistinct(fields ...Field) MySQLSelectQuery
SelectDistinct sets the SelectFields in the MySQLSelectQuery.
func (MySQLSelectQuery) SelectOne ¶
func (q MySQLSelectQuery) SelectOne(fields ...Field) MySQLSelectQuery
SelectOne sets the MySQLSelectQuery to SELECT 1.
func (MySQLSelectQuery) SetDialect ¶
func (q MySQLSelectQuery) SetDialect(dialect string) MySQLSelectQuery
SetDialect sets the dialect of the query.
func (MySQLSelectQuery) SetFetchableFields ¶
func (q MySQLSelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (MySQLSelectQuery) Where ¶
func (q MySQLSelectQuery) Where(predicates ...Predicate) MySQLSelectQuery
Where appends to the WherePredicate field in the MySQLSelectQuery.
type MySQLUpdateQuery ¶
type MySQLUpdateQuery UpdateQuery
MySQLUpdateQuery represents a MySQL UPDATE query.
func (MySQLUpdateQuery) CrossJoin ¶
func (q MySQLUpdateQuery) CrossJoin(table Table) MySQLUpdateQuery
CrossJoin cross joins a new Table to the MySQLUpdateQuery.
func (MySQLUpdateQuery) CustomJoin ¶
func (q MySQLUpdateQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) MySQLUpdateQuery
CustomJoin joins a new Table to the MySQLUpdateQuery with a custom join operator.
func (MySQLUpdateQuery) FullJoin ¶
func (q MySQLUpdateQuery) FullJoin(table Table, predicates ...Predicate) MySQLUpdateQuery
FullJoin full joins a new Table to the MySQLUpdateQuery.
func (MySQLUpdateQuery) GetDialect ¶
func (q MySQLUpdateQuery) GetDialect() string
GetDialect implements the Query interface.
func (MySQLUpdateQuery) GetFetchableFields ¶
func (q MySQLUpdateQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the MySQLUpdateQuery.
func (MySQLUpdateQuery) Join ¶
func (q MySQLUpdateQuery) Join(table Table, predicates ...Predicate) MySQLUpdateQuery
Join joins a new Table to the MySQLUpdateQuery.
func (MySQLUpdateQuery) JoinUsing ¶
func (q MySQLUpdateQuery) JoinUsing(table Table, fields ...Field) MySQLUpdateQuery
JoinUsing joins a new Table to the MySQLUpdateQuery with the USING operator.
func (MySQLUpdateQuery) LeftJoin ¶
func (q MySQLUpdateQuery) LeftJoin(table Table, predicates ...Predicate) MySQLUpdateQuery
LeftJoin left joins a new Table to the MySQLUpdateQuery.
func (MySQLUpdateQuery) Limit ¶
func (q MySQLUpdateQuery) Limit(limit any) MySQLUpdateQuery
Limit sets the LimitRows field of the MySQLUpdateQuery.
func (MySQLUpdateQuery) OrderBy ¶
func (q MySQLUpdateQuery) OrderBy(fields ...Field) MySQLUpdateQuery
OrderBy sets the OrderByFields of the MySQLUpdateQuery.
func (MySQLUpdateQuery) Set ¶
func (q MySQLUpdateQuery) Set(assignments ...Assignment) MySQLUpdateQuery
Set sets the Assignments field of the MySQLUpdateQuery.
func (MySQLUpdateQuery) SetDialect ¶
func (q MySQLUpdateQuery) SetDialect(dialect string) MySQLUpdateQuery
SetDialect sets the dialect of the MySQLUpdateQuery.
func (MySQLUpdateQuery) SetFetchableFields ¶
func (q MySQLUpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (MySQLUpdateQuery) SetFunc ¶
func (q MySQLUpdateQuery) SetFunc(colmapper func(*Column)) MySQLUpdateQuery
SetFunc sets the ColumnMapper of the MySQLUpdateQuery.
func (MySQLUpdateQuery) Where ¶
func (q MySQLUpdateQuery) Where(predicates ...Predicate) MySQLUpdateQuery
Where appends to the WherePredicate field of the MySQLUpdateQuery.
type NamedWindow ¶
NamedWindow represents an SQL named window.
func (NamedWindow) IsWindow ¶
func (w NamedWindow) IsWindow()
IsWindow implements the Window interface.
type NamedWindows ¶
type NamedWindows []NamedWindow
NamedWindows represents a slice of NamedWindows.
type NumberField ¶
type NumberField struct {
// contains filtered or unexported fields
}
NumberField represents an SQL number field.
func NewNumberField ¶
func NewNumberField(name string, tbl TableStruct) NumberField
NewNumberField returns a new NumberField.
func (NumberField) As ¶
func (f NumberField) As(alias string) NumberField
As returns a new NumberField with the given alias.
func (NumberField) Asc ¶
func (f NumberField) Asc() NumberField
Asc returns a new NumberField indicating that it should be ordered in ascending order i.e. 'ORDER BY field ASC'.
func (NumberField) Desc ¶
func (f NumberField) Desc() NumberField
Desc returns a new NumberField indicating that it should be ordered in ascending order i.e. 'ORDER BY field DESC'.
func (NumberField) Eq ¶
func (f NumberField) Eq(val Number) Predicate
Eq returns a 'field = val' Predicate.
func (NumberField) EqFloat64 ¶
func (f NumberField) EqFloat64(num float64) Predicate
EqFloat64 returns a 'field = num' Predicate.
func (NumberField) EqInt ¶
func (f NumberField) EqInt(num int) Predicate
EqInt returns a 'field = num' Predicate.
func (NumberField) EqInt64 ¶
func (f NumberField) EqInt64(num int64) Predicate
EqInt64 returns a 'field = num' Predicate.
func (NumberField) Ge ¶
func (f NumberField) Ge(val Number) Predicate
Ge returns a 'field >= val' Predicate.
func (NumberField) GeFloat64 ¶
func (f NumberField) GeFloat64(num float64) Predicate
GeFloat64 returns a 'field >= num' Predicate.
func (NumberField) GeInt ¶
func (f NumberField) GeInt(num int) Predicate
GeInt returns a 'field >= num' Predicate.
func (NumberField) GeInt64 ¶
func (f NumberField) GeInt64(num int64) Predicate
GeInt64 returns a 'field >= num' Predicate.
func (NumberField) GetAlias ¶
func (f NumberField) GetAlias() string
GetAlias returns the alias of the NumberField.
func (NumberField) Gt ¶
func (f NumberField) Gt(val Number) Predicate
Gt returns a 'field > val' Predicate.
func (NumberField) GtFloat64 ¶
func (f NumberField) GtFloat64(num float64) Predicate
GtFloat64 returns a 'field > num' Predicate.
func (NumberField) GtInt ¶
func (f NumberField) GtInt(num int) Predicate
GtInt returns a 'field > num' Predicate.
func (NumberField) GtInt64 ¶
func (f NumberField) GtInt64(num int64) Predicate
GtInt64 returns a 'field > num' Predicate.
func (NumberField) In ¶
func (f NumberField) In(val any) Predicate
In returns a 'field IN (val)' Predicate.
func (NumberField) IsNotNull ¶
func (f NumberField) IsNotNull() Predicate
IsNotNull returns a 'field IS NOT NULL' Predicate.
func (NumberField) IsNull ¶
func (f NumberField) IsNull() Predicate
IsNull returns a 'field IS NULL' Predicate.
func (NumberField) IsNumber ¶
func (f NumberField) IsNumber()
IsNumber implements the Number interface.
func (NumberField) Le ¶
func (f NumberField) Le(val Number) Predicate
Le returns a 'field <= val' Predicate.
func (NumberField) LeFloat64 ¶
func (f NumberField) LeFloat64(num float64) Predicate
LeFloat64 returns a 'field <= num' Predicate.
func (NumberField) LeInt ¶
func (f NumberField) LeInt(num int) Predicate
LeInt returns a 'field <= num' Predicate.
func (NumberField) LeInt64 ¶
func (f NumberField) LeInt64(num int64) Predicate
LeInt64 returns a 'field <= num' Predicate.
func (NumberField) Lt ¶
func (f NumberField) Lt(val Number) Predicate
Lt returns a 'field < val' Predicate.
func (NumberField) LtFloat64 ¶
func (f NumberField) LtFloat64(num float64) Predicate
LtFloat64 returns a 'field < num' Predicate.
func (NumberField) LtInt ¶
func (f NumberField) LtInt(num int) Predicate
LtInt returns a 'field < num' Predicate.
func (NumberField) LtInt64 ¶
func (f NumberField) LtInt64(num int64) Predicate
LtInt64 returns a 'field < num' Predicate.
func (NumberField) Ne ¶
func (f NumberField) Ne(val Number) Predicate
Ne returns a 'field <> val' Predicate.
func (NumberField) NeFloat64 ¶
func (f NumberField) NeFloat64(num float64) Predicate
NeFloat64 returns a 'field <> num' Predicate.
func (NumberField) NeInt ¶
func (f NumberField) NeInt(num int) Predicate
NeInt returns a 'field <> num' Predicate.
func (NumberField) NeInt64 ¶
func (f NumberField) NeInt64(num int64) Predicate
NeInt64 returns a 'field <> num' Predicate.
func (NumberField) NullsFirst ¶
func (f NumberField) NullsFirst() NumberField
NullsFirst returns a new NumberField indicating that it should be ordered with nulls first i.e. 'ORDER BY field NULLS FIRST'.
func (NumberField) NullsLast ¶
func (f NumberField) NullsLast() NumberField
NullsLast returns a new NumberField indicating that it should be ordered with nulls last i.e. 'ORDER BY field NULLS LAST'.
func (NumberField) Set ¶
func (f NumberField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (NumberField) SetFloat64 ¶
func (f NumberField) SetFloat64(num float64) Assignment
SetBytes returns an Assignment assigning an float64 to the field.
func (NumberField) SetInt ¶
func (f NumberField) SetInt(num int) Assignment
SetBytes returns an Assignment assigning an int to the field.
func (NumberField) SetInt64 ¶
func (f NumberField) SetInt64(num int64) Assignment
SetBytes returns an Assignment assigning an int64 to the field.
func (NumberField) Setf ¶
func (f NumberField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (NumberField) WithPrefix ¶
func (f NumberField) WithPrefix(prefix string) Field
WithPrefix returns a new Field that with the given prefix.
type NumberParameter ¶
NumberParameter functions as an sql.NamedArg, but implements the Number interface.
func Float64Param ¶
func Float64Param(name string, num float64) NumberParameter
Float64Param creates a new NumberParameter from an float64 value.
func Int64Param ¶
func Int64Param(name string, num int64) NumberParameter
Int64Param creates a new NumberParameter from an int64 value.
func IntParam ¶
func IntParam(name string, num int) NumberParameter
IntParam creates a new NumberParameter from an int value.
func (NumberParameter) GetAlias ¶
func (p NumberParameter) GetAlias() string
GetAlias implements the Field interface.
func (NumberParameter) IsField ¶
func (p NumberParameter) IsField()
IsField implements the Field interface.
func (NumberParameter) IsNumber ¶
func (p NumberParameter) IsNumber()
IsNumber implements the Number interface.
type Parameter ¶
Parameter functions as an sql.NamedArg, but implements the Field interface.
type PolicyTable ¶
PolicyTable is a table that produces a policy (i.e. a predicate) to be enforced whenever it is invoked in a query. This is equivalent to Postgres' Row Level Security (RLS) feature but works application-side. Only SELECT, UPDATE and DELETE queries are affected.
type PostgresDeleteQuery ¶
type PostgresDeleteQuery DeleteQuery
PostgresDeleteQuery represents a Postgres DELETE query.
func (PostgresDeleteQuery) CrossJoin ¶
func (q PostgresDeleteQuery) CrossJoin(table Table) PostgresDeleteQuery
CrossJoin cross joins a new Table to the PostgresDeleteQuery.
func (PostgresDeleteQuery) CustomJoin ¶
func (q PostgresDeleteQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) PostgresDeleteQuery
CustomJoin joins a new Table to the PostgresDeleteQuery with a custom join operator.
func (PostgresDeleteQuery) FullJoin ¶
func (q PostgresDeleteQuery) FullJoin(table Table, predicates ...Predicate) PostgresDeleteQuery
FullJoin full joins a new Table to the PostgresDeleteQuery.
func (PostgresDeleteQuery) GetDialect ¶
func (q PostgresDeleteQuery) GetDialect() string
GetDialect implements the Query interface.
func (PostgresDeleteQuery) GetFetchableFields ¶
func (q PostgresDeleteQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (PostgresDeleteQuery) Join ¶
func (q PostgresDeleteQuery) Join(table Table, predicates ...Predicate) PostgresDeleteQuery
Join joins a new Table to the PostgresDeleteQuery.
func (PostgresDeleteQuery) JoinUsing ¶
func (q PostgresDeleteQuery) JoinUsing(table Table, fields ...Field) PostgresDeleteQuery
JoinUsing joins a new Table to the PostgresDeleteQuery with the USING operator.
func (PostgresDeleteQuery) LeftJoin ¶
func (q PostgresDeleteQuery) LeftJoin(table Table, predicates ...Predicate) PostgresDeleteQuery
LeftJoin left joins a new Table to the PostgresDeleteQuery.
func (PostgresDeleteQuery) Returning ¶
func (q PostgresDeleteQuery) Returning(fields ...Field) PostgresDeleteQuery
Returning sets the ReturningFields field of the PostgresDeleteQuery.
func (PostgresDeleteQuery) SetDialect ¶
func (q PostgresDeleteQuery) SetDialect(dialect string) PostgresDeleteQuery
SetDialect sets the dialect of the query.
func (PostgresDeleteQuery) SetFetchableFields ¶
func (q PostgresDeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (PostgresDeleteQuery) Using ¶
func (q PostgresDeleteQuery) Using(table Table) PostgresDeleteQuery
Using sets the UsingTable field of the PostgresDeleteQuery.
func (PostgresDeleteQuery) Where ¶
func (q PostgresDeleteQuery) Where(predicates ...Predicate) PostgresDeleteQuery
Where appends to the WherePredicate field of the PostgresDeleteQuery.
type PostgresInsertQuery ¶
type PostgresInsertQuery InsertQuery
PostgresInsertQuery represents a Postgres INSERT query.
func (PostgresInsertQuery) ColumnValues ¶
func (q PostgresInsertQuery) ColumnValues(colmapper func(*Column)) PostgresInsertQuery
ColumnValues sets the ColumnMapper field of the PostgresInsertQuery.
func (PostgresInsertQuery) Columns ¶
func (q PostgresInsertQuery) Columns(fields ...Field) PostgresInsertQuery
Columns sets the InsertColumns field of the PostgresInsertQuery.
func (PostgresInsertQuery) GetDialect ¶
func (q PostgresInsertQuery) GetDialect() string
GetDialect implements the Query interface.
func (PostgresInsertQuery) GetFetchableFields ¶
func (q PostgresInsertQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (PostgresInsertQuery) OnConflict ¶
func (q PostgresInsertQuery) OnConflict(fields ...Field) postgresInsertConflict
OnConflict starts the ON CONFLICT clause of the PostgresInsertQuery.
func (PostgresInsertQuery) OnConflictOnConstraint ¶
func (q PostgresInsertQuery) OnConflictOnConstraint(constraintName string) postgresInsertConflict
OnConflict starts the ON CONFLICT clause of the PostgresInsertQuery.
func (PostgresInsertQuery) Returning ¶
func (q PostgresInsertQuery) Returning(fields ...Field) PostgresInsertQuery
Returning sets the ReturningFields of the PostgresInsertQuery.
func (PostgresInsertQuery) Select ¶
func (q PostgresInsertQuery) Select(query Query) PostgresInsertQuery
Select sets the SelectQuery field of the PostgresInsertQuery.
func (PostgresInsertQuery) SetDialect ¶
func (q PostgresInsertQuery) SetDialect(dialect string) PostgresInsertQuery
SetDialect returns the dialect of the query.
func (PostgresInsertQuery) SetFetchableFields ¶
func (q PostgresInsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (PostgresInsertQuery) Values ¶
func (q PostgresInsertQuery) Values(values ...any) PostgresInsertQuery
Values sets the RowValues field of the PostgresInsertQuery.
func (PostgresInsertQuery) Where ¶
func (q PostgresInsertQuery) Where(predicates ...Predicate) PostgresInsertQuery
Where adds predicates to the DO UPDATE SET clause of the PostgresInsertQuery.
type PostgresSelectQuery ¶
type PostgresSelectQuery SelectQuery
PostgresSelectQuery represents a Postgres SELECT query.
func (PostgresSelectQuery) As ¶
func (q PostgresSelectQuery) As(alias string, columns ...string) PostgresSelectQuery
As returns a new PostgresSelectQuery with the table alias (and optionally column aliases).
func (PostgresSelectQuery) CrossJoin ¶
func (q PostgresSelectQuery) CrossJoin(table Table) PostgresSelectQuery
CrossJoin cross joins a new Table to the PostgresSelectQuery.
func (PostgresSelectQuery) CustomJoin ¶
func (q PostgresSelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) PostgresSelectQuery
CustomJoin joins a new Table to the PostgresSelectQuery with a custom join operator.
func (PostgresSelectQuery) DistinctOn ¶
func (q PostgresSelectQuery) DistinctOn(fields ...Field) PostgresSelectQuery
DistinctOn sets the DistinctOnFields in the PostgresSelectQuery.
func (PostgresSelectQuery) FetchNext ¶
func (q PostgresSelectQuery) FetchNext(n any) PostgresSelectQuery
FetchNext sets the FetchNextRows field in the PostgresSelectQuery.
func (PostgresSelectQuery) Field ¶
func (q PostgresSelectQuery) Field(name string) AnyField
Field returns a new field qualified by the PostgresSelectQuery's alias.
func (PostgresSelectQuery) From ¶
func (q PostgresSelectQuery) From(table Table) PostgresSelectQuery
From sets the FromTable field in the PostgresSelectQuery.
func (PostgresSelectQuery) FullJoin ¶
func (q PostgresSelectQuery) FullJoin(table Table, predicates ...Predicate) PostgresSelectQuery
FullJoin full joins a new Table to the PostgresSelectQuery.
func (PostgresSelectQuery) GetAlias ¶
func (q PostgresSelectQuery) GetAlias() string
GetAlias returns the alias of the PostgresSelectQuery.
func (PostgresSelectQuery) GetDialect ¶
func (q PostgresSelectQuery) GetDialect() string
GetDialect implements the Query interface.
func (PostgresSelectQuery) GetFetchableFields ¶
func (q PostgresSelectQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (PostgresSelectQuery) GroupBy ¶
func (q PostgresSelectQuery) GroupBy(fields ...Field) PostgresSelectQuery
GroupBy appends to the GroupByFields field in the PostgresSelectQuery.
func (PostgresSelectQuery) Having ¶
func (q PostgresSelectQuery) Having(predicates ...Predicate) PostgresSelectQuery
Having appends to the HavingPredicate field in the PostgresSelectQuery.
func (PostgresSelectQuery) IsArray ¶
func (q PostgresSelectQuery) IsArray()
IsArray implements the Array interface.
func (PostgresSelectQuery) IsBinary ¶
func (q PostgresSelectQuery) IsBinary()
IsBinary implements the Binary interface.
func (PostgresSelectQuery) IsBoolean ¶
func (q PostgresSelectQuery) IsBoolean()
IsBoolean implements the Boolean interface.
func (PostgresSelectQuery) IsEnum ¶
func (q PostgresSelectQuery) IsEnum()
IsEnum implements the Enum interface.
func (PostgresSelectQuery) IsField ¶
func (q PostgresSelectQuery) IsField()
IsField implements the Field interface.
func (PostgresSelectQuery) IsJSON ¶
func (q PostgresSelectQuery) IsJSON()
IsJSON implements the JSON interface.
func (PostgresSelectQuery) IsNumber ¶
func (q PostgresSelectQuery) IsNumber()
IsNumber implements the Number interface.
func (PostgresSelectQuery) IsString ¶
func (q PostgresSelectQuery) IsString()
IsString implements the String interface.
func (PostgresSelectQuery) IsTable ¶
func (q PostgresSelectQuery) IsTable()
IsTable implements the Table interface.
func (PostgresSelectQuery) IsTime ¶
func (q PostgresSelectQuery) IsTime()
IsTime implements the Time interface.
func (PostgresSelectQuery) IsUUID ¶
func (q PostgresSelectQuery) IsUUID()
IsUUID implements the UUID interface.
func (PostgresSelectQuery) Join ¶
func (q PostgresSelectQuery) Join(table Table, predicates ...Predicate) PostgresSelectQuery
Join joins a new Table to the PostgresSelectQuery.
func (PostgresSelectQuery) JoinUsing ¶
func (q PostgresSelectQuery) JoinUsing(table Table, fields ...Field) PostgresSelectQuery
JoinUsing joins a new Table to the PostgresSelectQuery with the USING operator.
func (PostgresSelectQuery) LeftJoin ¶
func (q PostgresSelectQuery) LeftJoin(table Table, predicates ...Predicate) PostgresSelectQuery
LeftJoin left joins a new Table to the PostgresSelectQuery.
func (PostgresSelectQuery) Limit ¶
func (q PostgresSelectQuery) Limit(limit any) PostgresSelectQuery
Limit sets the LimitRows field in the PostgresSelectQuery.
func (PostgresSelectQuery) LockRows ¶
func (q PostgresSelectQuery) LockRows(lockClause string, lockValues ...any) PostgresSelectQuery
LockRows sets the lock clause of the PostgresSelectQuery.
func (PostgresSelectQuery) Offset ¶
func (q PostgresSelectQuery) Offset(offset any) PostgresSelectQuery
Offset sets the OffsetRows field in the PostgresSelectQuery.
func (PostgresSelectQuery) OrderBy ¶
func (q PostgresSelectQuery) OrderBy(fields ...Field) PostgresSelectQuery
OrderBy appends to the OrderByFields field in the PostgresSelectQuery.
func (PostgresSelectQuery) Select ¶
func (q PostgresSelectQuery) Select(fields ...Field) PostgresSelectQuery
Select appends to the SelectFields in the PostgresSelectQuery.
func (PostgresSelectQuery) SelectDistinct ¶
func (q PostgresSelectQuery) SelectDistinct(fields ...Field) PostgresSelectQuery
SelectDistinct sets the SelectFields in the PostgresSelectQuery.
func (PostgresSelectQuery) SelectOne ¶
func (q PostgresSelectQuery) SelectOne(fields ...Field) PostgresSelectQuery
SelectOne sets the PostgresSelectQuery to SELECT 1.
func (PostgresSelectQuery) SetDialect ¶
func (q PostgresSelectQuery) SetDialect(dialect string) PostgresSelectQuery
SetDialect sets the dialect of the query.
func (PostgresSelectQuery) SetFetchableFields ¶
func (q PostgresSelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (PostgresSelectQuery) Where ¶
func (q PostgresSelectQuery) Where(predicates ...Predicate) PostgresSelectQuery
Where appends to the WherePredicate field in the PostgresSelectQuery.
func (PostgresSelectQuery) WithTies ¶
func (q PostgresSelectQuery) WithTies() PostgresSelectQuery
WithTies enables the FetchWithTies field in the PostgresSelectQuery.
type PostgresUpdateQuery ¶
type PostgresUpdateQuery UpdateQuery
PostgresUpdateQuery represents a Postgres UPDATE query.
func (PostgresUpdateQuery) CrossJoin ¶
func (q PostgresUpdateQuery) CrossJoin(table Table) PostgresUpdateQuery
CrossJoin cross joins a new Table to the PostgresUpdateQuery.
func (PostgresUpdateQuery) CustomJoin ¶
func (q PostgresUpdateQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) PostgresUpdateQuery
CustomJoin joins a new Table to the PostgresUpdateQuery with a custom join operator.
func (PostgresUpdateQuery) From ¶
func (q PostgresUpdateQuery) From(table Table) PostgresUpdateQuery
From sets the FromTable field of the PostgresUpdateQuery.
func (PostgresUpdateQuery) FullJoin ¶
func (q PostgresUpdateQuery) FullJoin(table Table, predicates ...Predicate) PostgresUpdateQuery
FullJoin full joins a new Table to the PostgresUpdateQuery.
func (PostgresUpdateQuery) GetDialect ¶
func (q PostgresUpdateQuery) GetDialect() string
GetDialect implements the Query interface.
func (PostgresUpdateQuery) GetFetchableFields ¶
func (q PostgresUpdateQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the PostgresUpdateQuery.
func (PostgresUpdateQuery) Join ¶
func (q PostgresUpdateQuery) Join(table Table, predicates ...Predicate) PostgresUpdateQuery
Join joins a new Table to the PostgresUpdateQuery.
func (PostgresUpdateQuery) JoinUsing ¶
func (q PostgresUpdateQuery) JoinUsing(table Table, fields ...Field) PostgresUpdateQuery
JoinUsing joins a new Table to the PostgresUpdateQuery with the USING operator.
func (PostgresUpdateQuery) LeftJoin ¶
func (q PostgresUpdateQuery) LeftJoin(table Table, predicates ...Predicate) PostgresUpdateQuery
LeftJoin left joins a new Table to the PostgresUpdateQuery.
func (PostgresUpdateQuery) Returning ¶
func (q PostgresUpdateQuery) Returning(fields ...Field) PostgresUpdateQuery
Returning sets the ReturningFields field of the PostgresUpdateQuery.
func (PostgresUpdateQuery) Set ¶
func (q PostgresUpdateQuery) Set(assignments ...Assignment) PostgresUpdateQuery
Set sets the Assignments field of the PostgresUpdateQuery.
func (PostgresUpdateQuery) SetDialect ¶
func (q PostgresUpdateQuery) SetDialect(dialect string) PostgresUpdateQuery
SetDialect sets the dialect of the PostgresUpdateQuery.
func (PostgresUpdateQuery) SetFetchableFields ¶
func (q PostgresUpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (PostgresUpdateQuery) SetFunc ¶
func (q PostgresUpdateQuery) SetFunc(colmapper func(*Column)) PostgresUpdateQuery
SetFunc sets the ColumnMapper of the PostgresUpdateQuery.
func (PostgresUpdateQuery) Where ¶
func (q PostgresUpdateQuery) Where(predicates ...Predicate) PostgresUpdateQuery
Where appends to the WherePredicate field of the PostgresUpdateQuery.
type Predicate ¶
type Predicate interface { Boolean }
Predicate is an SQL expression that evaluates to true or false.
type PredicateCase ¶
PredicateCase holds the result to be used for a given predicate in a CaseExpression.
type PredicateCases ¶
type PredicateCases = []PredicateCase
PredicateCases is a slice of PredicateCases.
type PreparedExec ¶
type PreparedExec struct {
// contains filtered or unexported fields
}
PrepareExec is the result of preparing a CompiledExec on a DB.
func PrepareExec ¶
func PrepareExec(db DB, q Query) (*PreparedExec, error)
PrepareExec returns a new PreparedExec.
func PrepareExecContext ¶
PrepareExecContext is like PrepareExec but additionally requires a context.Context.
func (*PreparedExec) Exec ¶
func (e *PreparedExec) Exec(params Params) (Result, error)
Exec executes the PreparedExec with the given params.
func (*PreparedExec) ExecContext ¶
ExecContext is like Exec but additionally requires a context.Context.
type PreparedFetch ¶
type PreparedFetch[T any] struct { // contains filtered or unexported fields }
PreparedFetch is the result of preparing a CompiledFetch on a DB.
func PrepareFetch ¶
PrepareFetch returns a new PreparedFetch.
func PrepareFetchContext ¶
func PrepareFetchContext[T any](ctx context.Context, db DB, q Query, rowmapper func(*Row) T) (*PreparedFetch[T], error)
PrepareFetchContext is like PrepareFetch but additionally requires a context.Context.
func (*PreparedFetch[T]) Close ¶
func (f *PreparedFetch[T]) Close() error
Close closes the PreparedFetch.
func (*PreparedFetch[T]) FetchAll ¶
func (f *PreparedFetch[T]) FetchAll(params Params) ([]T, error)
FetchAll returns all the results from running the PreparedFetch with the give params.
func (*PreparedFetch[T]) FetchAllContext ¶
func (f *PreparedFetch[T]) FetchAllContext(ctx context.Context, params Params) ([]T, error)
FetchAllContext is like FetchAll but additionally requires a context.Context.
func (PreparedFetch[T]) FetchCursor ¶
func (f PreparedFetch[T]) FetchCursor(params Params) (*Cursor[T], error)
FetchCursor returns a new cursor.
func (PreparedFetch[T]) FetchCursorContext ¶
func (f PreparedFetch[T]) FetchCursorContext(ctx context.Context, params Params) (*Cursor[T], error)
FetchCursorContext is like FetchCursor but additionally requires a context.Context.
func (*PreparedFetch[T]) FetchOne ¶
func (f *PreparedFetch[T]) FetchOne(params Params) (T, error)
FetchOne returns the first result from running the PreparedFetch with the give params.
func (*PreparedFetch[T]) FetchOneContext ¶
func (f *PreparedFetch[T]) FetchOneContext(ctx context.Context, params Params) (T, error)
FetchOneContext is like FetchOne but additionally requires a context.Context.
func (*PreparedFetch[T]) GetCompiled ¶
func (f *PreparedFetch[T]) GetCompiled() *CompiledFetch[T]
GetCompiled returns a copy of the underlying CompiledFetch.
type Query ¶
type Query interface { SQLWriter // SetFetchableFields should return a query with its fetchable fields set // to the given fields. If not applicable, it should return false as the // second return value. SetFetchableFields([]Field) (query Query, ok bool) GetDialect() string }
Query is either SELECT, INSERT, UPDATE or DELETE.
type QueryStats ¶
type QueryStats struct { // Dialect of the query. Dialect string // Query string. Query string // Args slice provided with the query string. Args []any // Params maps param names back to arguments in the args slice (by index). Params map[string][]int // Err is the error from running the query. Err error // RowCount from running the query. Not valid for Exec(). RowCount sql.NullInt64 // RowsAffected by running the query. Not valid for // FetchOne/FetchAll/FetchCursor. RowsAffected sql.NullInt64 // LastInsertId of the query. LastInsertId sql.NullInt64 // Exists is the result of FetchExists(). Exists sql.NullBool // When the query started at. StartedAt time.Time // Time taken by the query. TimeTaken time.Duration // The caller file where the query was invoked. CallerFile string // The line in the caller file that invoked the query. CallerLine int // The name of the function where the query was invoked. CallerFunction string // The results from running the query (if it was provided). Results string }
QueryStats represents the statistics from running a query.
type Result ¶
Result is the result of an Exec command.
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row represents the state of a row after a call to rows.Next().
func (*Row) ArrayField ¶
ArrayField scans the array field into dest.
func (*Row) BytesField ¶
BytesField returns the []byte value of the field.
func (*Row) Enum ¶
func (r *Row) Enum(dest Enumeration, format string, values ...any)
Enum scans the enum expression into dest.
func (*Row) EnumField ¶
func (r *Row) EnumField(dest Enumeration, field Enum)
EnumField scans the enum field into dest.
func (*Row) Float64Field ¶
Float64Field returns the float64 value of the field.
func (*Row) Int64Field ¶
Int64Field returns the int64 value of the field.
func (*Row) NullBoolField ¶
NullBoolField returns the sql.NullBool value of the field.
func (*Row) NullFloat64 ¶
func (r *Row) NullFloat64(format string, values ...any) sql.NullFloat64
NullFloat64 returns the sql.NullFloat64 valye of the expression.
func (*Row) NullFloat64Field ¶
func (r *Row) NullFloat64Field(field Number) sql.NullFloat64
NullFloat64Field returns the sql.NullFloat64 value of the field.
func (*Row) NullInt64Field ¶
NullInt64Field returns the sql.NullInt64 value of the field.
func (*Row) NullString ¶
func (r *Row) NullString(format string, values ...any) sql.NullString
NullString returns the sql.NullString value of the expression.
func (*Row) NullStringField ¶
func (r *Row) NullStringField(field String) sql.NullString
NullStringField returns the sql.NullString value of the field.
func (*Row) NullTimeField ¶
NullTimeField returns the sql.NullTime value of the field.
func (*Row) StringField ¶
String returns the string value of the field.
type RowValue ¶
type RowValue []any
RowValue represents an SQL row value expression e.g. (x, y, z).
type RowValues ¶
type RowValues []RowValue
RowValues represents a list of RowValues e.g. (x, y, z), (a, b, c).
type SQLServerDeleteQuery ¶
type SQLServerDeleteQuery DeleteQuery
SQLServerDeleteQuery represents an SQL Server DELETE query.
func (SQLServerDeleteQuery) CrossJoin ¶
func (q SQLServerDeleteQuery) CrossJoin(table Table) SQLServerDeleteQuery
CrossJoin cross joins a new Table to the SQLServerDeleteQuery.
func (SQLServerDeleteQuery) CustomJoin ¶
func (q SQLServerDeleteQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLServerDeleteQuery
CustomJoin joins a new Table to the SQLServerDeleteQuery with a custom join operator.
func (SQLServerDeleteQuery) From ¶
func (q SQLServerDeleteQuery) From(table Table) SQLServerDeleteQuery
From sets the UsingTable of the SQLServerDeleteQuery.
func (SQLServerDeleteQuery) FullJoin ¶
func (q SQLServerDeleteQuery) FullJoin(table Table, predicates ...Predicate) SQLServerDeleteQuery
FullJoin full joins a new Table to the SQLServerDeleteQuery.
func (SQLServerDeleteQuery) GetDialect ¶
func (q SQLServerDeleteQuery) GetDialect() string
GetDialect implements the Query interface.
func (SQLServerDeleteQuery) GetFetchableFields ¶
func (q SQLServerDeleteQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (SQLServerDeleteQuery) Join ¶
func (q SQLServerDeleteQuery) Join(table Table, predicates ...Predicate) SQLServerDeleteQuery
Join joins a new Table to the SQLServerDeleteQuery.
func (SQLServerDeleteQuery) LeftJoin ¶
func (q SQLServerDeleteQuery) LeftJoin(table Table, predicates ...Predicate) SQLServerDeleteQuery
LeftJoin left joins a new Table to the SQLServerDeleteQuery.
func (SQLServerDeleteQuery) SetDialect ¶
func (q SQLServerDeleteQuery) SetDialect(dialect string) SQLServerDeleteQuery
SetDialect sets the dialect of the query.
func (SQLServerDeleteQuery) SetFetchableFields ¶
func (q SQLServerDeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SQLServerDeleteQuery) Where ¶
func (q SQLServerDeleteQuery) Where(predicates ...Predicate) SQLServerDeleteQuery
Where appends to the WherePredicate field of the SQLServerDeleteQuery.
type SQLServerInsertQuery ¶
type SQLServerInsertQuery InsertQuery
SQLServerInsertQuery represents an SQL Server INSERT query.
func (SQLServerInsertQuery) ColumnValues ¶
func (q SQLServerInsertQuery) ColumnValues(colmapper func(*Column)) SQLServerInsertQuery
ColumnValues sets the ColumnMapper field of the SQLServerInsertQuery.
func (SQLServerInsertQuery) Columns ¶
func (q SQLServerInsertQuery) Columns(fields ...Field) SQLServerInsertQuery
Columns sets the InsertColumns field of the SQLServerInsertQuery.
func (SQLServerInsertQuery) GetDialect ¶
func (q SQLServerInsertQuery) GetDialect() string
GetDialect implements the Query interface.
func (SQLServerInsertQuery) GetFetchableFields ¶
func (q SQLServerInsertQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (SQLServerInsertQuery) Select ¶
func (q SQLServerInsertQuery) Select(query Query) SQLServerInsertQuery
Select sets the SelectQuery field of the SQLServerInsertQuery.
func (SQLServerInsertQuery) SetDialect ¶
func (q SQLServerInsertQuery) SetDialect(dialect string) SQLServerInsertQuery
SetDialect returns the dialect of the query.
func (SQLServerInsertQuery) SetFetchableFields ¶
func (q SQLServerInsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SQLServerInsertQuery) Values ¶
func (q SQLServerInsertQuery) Values(values ...any) SQLServerInsertQuery
Values sets the RowValues field of the SQLServerInsertQuery.
type SQLServerSelectQuery ¶
type SQLServerSelectQuery SelectQuery
SQLServerSelectQuery represents an SQL Server SELECT query.
func (SQLServerSelectQuery) As ¶
func (q SQLServerSelectQuery) As(alias string, columns ...string) SQLServerSelectQuery
As returns a new SQLServerSelectQuery with the table alias (and optionally column aliases).
func (SQLServerSelectQuery) CrossJoin ¶
func (q SQLServerSelectQuery) CrossJoin(table Table) SQLServerSelectQuery
CrossJoin cross joins a new Table to the SQLServerSelectQuery.
func (SQLServerSelectQuery) CustomJoin ¶
func (q SQLServerSelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLServerSelectQuery
CustomJoin joins a new Table to the SQLServerSelectQuery with a custom join operator.
func (SQLServerSelectQuery) FetchNext ¶
func (q SQLServerSelectQuery) FetchNext(n any) SQLServerSelectQuery
FetchNext sets the FetchNextRows field in the SQLServerSelectQuery.
func (SQLServerSelectQuery) Field ¶
func (q SQLServerSelectQuery) Field(name string) AnyField
Field returns a new field qualified by the SQLServerSelectQuery's alias.
func (SQLServerSelectQuery) From ¶
func (q SQLServerSelectQuery) From(table Table) SQLServerSelectQuery
From sets the FromTable field in the SQLServerSelectQuery.
func (SQLServerSelectQuery) FullJoin ¶
func (q SQLServerSelectQuery) FullJoin(table Table, predicates ...Predicate) SQLServerSelectQuery
FullJoin full joins a new Table to the SQLServerSelectQuery.
func (SQLServerSelectQuery) GetAlias ¶
func (q SQLServerSelectQuery) GetAlias() string
GetAlias returns the alias of the SQLServerSelectQuery.
func (SQLServerSelectQuery) GetDialect ¶
func (q SQLServerSelectQuery) GetDialect() string
GetDialect implements the Query interface.
func (SQLServerSelectQuery) GetFetchableFields ¶
func (q SQLServerSelectQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (SQLServerSelectQuery) GroupBy ¶
func (q SQLServerSelectQuery) GroupBy(fields ...Field) SQLServerSelectQuery
GroupBy appends to the GroupByFields field in the SQLServerSelectQuery.
func (SQLServerSelectQuery) Having ¶
func (q SQLServerSelectQuery) Having(predicates ...Predicate) SQLServerSelectQuery
Having appends to the HavingPredicate field in the SQLServerSelectQuery.
func (SQLServerSelectQuery) IsArray ¶
func (q SQLServerSelectQuery) IsArray()
IsArray implements the Array interface.
func (SQLServerSelectQuery) IsBinary ¶
func (q SQLServerSelectQuery) IsBinary()
IsBinary implements the Binary interface.
func (SQLServerSelectQuery) IsBoolean ¶
func (q SQLServerSelectQuery) IsBoolean()
IsBoolean implements the Boolean interface.
func (SQLServerSelectQuery) IsEnum ¶
func (q SQLServerSelectQuery) IsEnum()
IsEnum implements the Enum interface.
func (SQLServerSelectQuery) IsField ¶
func (q SQLServerSelectQuery) IsField()
IsField implements the Field interface.
func (SQLServerSelectQuery) IsJSON ¶
func (q SQLServerSelectQuery) IsJSON()
IsJSON implements the JSON interface.
func (SQLServerSelectQuery) IsNumber ¶
func (q SQLServerSelectQuery) IsNumber()
IsNumber implements the Number interface.
func (SQLServerSelectQuery) IsString ¶
func (q SQLServerSelectQuery) IsString()
IsString implements the String interface.
func (SQLServerSelectQuery) IsTable ¶
func (q SQLServerSelectQuery) IsTable()
IsTable implements the Table interface.
func (SQLServerSelectQuery) IsTime ¶
func (q SQLServerSelectQuery) IsTime()
IsTime implements the Time interface.
func (SQLServerSelectQuery) IsUUID ¶
func (q SQLServerSelectQuery) IsUUID()
IsUUID implements the UUID interface.
func (SQLServerSelectQuery) Join ¶
func (q SQLServerSelectQuery) Join(table Table, predicates ...Predicate) SQLServerSelectQuery
Join joins a new Table to the SQLServerSelectQuery.
func (SQLServerSelectQuery) LeftJoin ¶
func (q SQLServerSelectQuery) LeftJoin(table Table, predicates ...Predicate) SQLServerSelectQuery
LeftJoin left joins a new Table to the SQLServerSelectQuery.
func (SQLServerSelectQuery) Offset ¶
func (q SQLServerSelectQuery) Offset(offset any) SQLServerSelectQuery
Offset sets the OffsetRows field in the SQLServerSelectQuery.
func (SQLServerSelectQuery) OrderBy ¶
func (q SQLServerSelectQuery) OrderBy(fields ...Field) SQLServerSelectQuery
OrderBy appends to the OrderByFields field in the SQLServerSelectQuery.
func (SQLServerSelectQuery) Select ¶
func (q SQLServerSelectQuery) Select(fields ...Field) SQLServerSelectQuery
Select appends to the SelectFields in the SQLServerSelectQuery.
func (SQLServerSelectQuery) SelectDistinct ¶
func (q SQLServerSelectQuery) SelectDistinct(fields ...Field) SQLServerSelectQuery
SelectDistinct sets the SelectFields in the SQLServerSelectQuery.
func (SQLServerSelectQuery) SelectOne ¶
func (q SQLServerSelectQuery) SelectOne(fields ...Field) SQLServerSelectQuery
SelectOne sets the SQLServerSelectQuery to SELECT 1.
func (SQLServerSelectQuery) SetDialect ¶
func (q SQLServerSelectQuery) SetDialect(dialect string) SQLServerSelectQuery
SetDialect sets the dialect of the query.
func (SQLServerSelectQuery) SetFetchableFields ¶
func (q SQLServerSelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SQLServerSelectQuery) Top ¶
func (q SQLServerSelectQuery) Top(limit any) SQLServerSelectQuery
Top sets the LimitTop field of the SQLServerSelectQuery.
func (SQLServerSelectQuery) TopPercent ¶
func (q SQLServerSelectQuery) TopPercent(percentLimit any) SQLServerSelectQuery
Top sets the LimitTopPercent field of the SQLServerSelectQuery.
func (SQLServerSelectQuery) Where ¶
func (q SQLServerSelectQuery) Where(predicates ...Predicate) SQLServerSelectQuery
Where appends to the WherePredicate field in the SQLServerSelectQuery.
func (SQLServerSelectQuery) WithTies ¶
func (q SQLServerSelectQuery) WithTies() SQLServerSelectQuery
WithTies enables the FetchWithTies field in the SQLServerSelectQuery.
type SQLServerUpdateQuery ¶
type SQLServerUpdateQuery UpdateQuery
SQLServerUpdateQuery represents an SQL Server UPDATE query.
func (SQLServerUpdateQuery) CrossJoin ¶
func (q SQLServerUpdateQuery) CrossJoin(table Table) SQLServerUpdateQuery
CrossJoin cross joins a new Table to the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) CustomJoin ¶
func (q SQLServerUpdateQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLServerUpdateQuery
CustomJoin joins a new Table to the SQLServerUpdateQuery with a custom join operator.
func (SQLServerUpdateQuery) From ¶
func (q SQLServerUpdateQuery) From(table Table) SQLServerUpdateQuery
From sets the FromTable field of the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) FullJoin ¶
func (q SQLServerUpdateQuery) FullJoin(table Table, predicates ...Predicate) SQLServerUpdateQuery
FullJoin full joins a new Table to the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) GetDialect ¶
func (q SQLServerUpdateQuery) GetDialect() string
GetDialect implements the Query interface.
func (SQLServerUpdateQuery) GetFetchableFields ¶
func (q SQLServerUpdateQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) Join ¶
func (q SQLServerUpdateQuery) Join(table Table, predicates ...Predicate) SQLServerUpdateQuery
Join joins a new Table to the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) LeftJoin ¶
func (q SQLServerUpdateQuery) LeftJoin(table Table, predicates ...Predicate) SQLServerUpdateQuery
LeftJoin left joins a new Table to the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) Set ¶
func (q SQLServerUpdateQuery) Set(assignments ...Assignment) SQLServerUpdateQuery
Set sets the Assignments field of the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) SetDialect ¶
func (q SQLServerUpdateQuery) SetDialect(dialect string) SQLServerUpdateQuery
SetDialect sets the dialect of the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) SetFetchableFields ¶
func (q SQLServerUpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SQLServerUpdateQuery) SetFunc ¶
func (q SQLServerUpdateQuery) SetFunc(colmapper func(*Column)) SQLServerUpdateQuery
SetFunc sets the ColumnMapper of the SQLServerUpdateQuery.
func (SQLServerUpdateQuery) Where ¶
func (q SQLServerUpdateQuery) Where(predicates ...Predicate) SQLServerUpdateQuery
Where appends to the WherePredicate field of the SQLServerUpdateQuery.
type SQLWriter ¶
type SQLWriter interface { // WriteSQL writes the SQL representation of the SQLWriter into the query // string (*bytes.Buffer) and args slice (*[]any). // // The params map is used to hold the mappings between named parameters in // the query to the corresponding index in the args slice and is used for // rebinding args by their parameter name. The params map may be nil, check // first before writing to it. WriteSQL(ctx context.Context, dialect string, buf *bytes.Buffer, args *[]any, params map[string][]int) error }
SQLWriter is anything that can be converted to SQL.
type SQLiteDeleteQuery ¶
type SQLiteDeleteQuery DeleteQuery
SQLiteDeleteQuery represents an SQLite DELETE query.
func (SQLiteDeleteQuery) GetDialect ¶
func (q SQLiteDeleteQuery) GetDialect() string
GetDialect implements the Query interface.
func (SQLiteDeleteQuery) GetFetchableFields ¶
func (q SQLiteDeleteQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (SQLiteDeleteQuery) Returning ¶
func (q SQLiteDeleteQuery) Returning(fields ...Field) SQLiteDeleteQuery
Returning sets the ReturningFields field of the SQLiteDeleteQuery.
func (SQLiteDeleteQuery) SetDialect ¶
func (q SQLiteDeleteQuery) SetDialect(dialect string) SQLiteDeleteQuery
SetDialect sets the dialect of the query.
func (SQLiteDeleteQuery) SetFetchableFields ¶
func (q SQLiteDeleteQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SQLiteDeleteQuery) Where ¶
func (q SQLiteDeleteQuery) Where(predicates ...Predicate) SQLiteDeleteQuery
Where appends to the WherePredicate field of the SQLiteDeleteQuery.
type SQLiteInsertQuery ¶
type SQLiteInsertQuery InsertQuery
SQLiteInsertQuery represents an SQLite INSERT query.
func (SQLiteInsertQuery) ColumnValues ¶
func (q SQLiteInsertQuery) ColumnValues(colmapper func(*Column)) SQLiteInsertQuery
ColumnValues sets the ColumnMapper field of the SQLiteInsertQuery.
func (SQLiteInsertQuery) Columns ¶
func (q SQLiteInsertQuery) Columns(fields ...Field) SQLiteInsertQuery
Columns sets the InsertColumns field of the SQLiteInsertQuery.
func (SQLiteInsertQuery) GetDialect ¶
func (q SQLiteInsertQuery) GetDialect() string
GetDialect implements the Query interface.
func (SQLiteInsertQuery) GetFetchableFields ¶
func (q SQLiteInsertQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (SQLiteInsertQuery) OnConflict ¶
func (q SQLiteInsertQuery) OnConflict(fields ...Field) sqliteInsertConflict
OnConflict starts the ON CONFLICT clause of the SQLiteInsertQuery.
func (SQLiteInsertQuery) Returning ¶
func (q SQLiteInsertQuery) Returning(fields ...Field) SQLiteInsertQuery
Returning sets the ReturningFields of the SQLiteInsertQuery.
func (SQLiteInsertQuery) Select ¶
func (q SQLiteInsertQuery) Select(query Query) SQLiteInsertQuery
Select sets the SelectQuery field of the SQLiteInsertQuery.
func (SQLiteInsertQuery) SetDialect ¶
func (q SQLiteInsertQuery) SetDialect(dialect string) SQLiteInsertQuery
SetDialect returns the dialect of the query.
func (SQLiteInsertQuery) SetFetchableFields ¶
func (q SQLiteInsertQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SQLiteInsertQuery) Values ¶
func (q SQLiteInsertQuery) Values(values ...any) SQLiteInsertQuery
Values sets the RowValues field of the SQLiteInsertQuery.
func (SQLiteInsertQuery) Where ¶
func (q SQLiteInsertQuery) Where(predicates ...Predicate) SQLiteInsertQuery
Where adds predicates to the DO UPDATE SET clause of the SQLiteInsertQuery.
type SQLiteSelectQuery ¶
type SQLiteSelectQuery SelectQuery
SQLiteSelectQuery represents an SQLite SELECT query.
func (SQLiteSelectQuery) As ¶
func (q SQLiteSelectQuery) As(alias string, columns ...string) SQLiteSelectQuery
As returns a new SQLiteSelectQuery with the table alias (and optionally column aliases).
func (SQLiteSelectQuery) CrossJoin ¶
func (q SQLiteSelectQuery) CrossJoin(table Table) SQLiteSelectQuery
CrossJoin cross joins a new Table to the SQLiteSelectQuery.
func (SQLiteSelectQuery) CustomJoin ¶
func (q SQLiteSelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLiteSelectQuery
CustomJoin joins a new Table to the SQLiteSelectQuery with a custom join operator.
func (SQLiteSelectQuery) Field ¶
func (q SQLiteSelectQuery) Field(name string) AnyField
Field returns a new field qualified by the SQLiteSelectQuery's alias.
func (SQLiteSelectQuery) From ¶
func (q SQLiteSelectQuery) From(table Table) SQLiteSelectQuery
From sets the FromTable field in the SQLiteSelectQuery.
func (SQLiteSelectQuery) GetAlias ¶
func (q SQLiteSelectQuery) GetAlias() string
GetAlias returns the alias of the SQLiteSelectQuery.
func (SQLiteSelectQuery) GetDialect ¶
func (q SQLiteSelectQuery) GetDialect() string
GetDialect implements the Query interface.
func (SQLiteSelectQuery) GetFetchableFields ¶
func (q SQLiteSelectQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (SQLiteSelectQuery) GroupBy ¶
func (q SQLiteSelectQuery) GroupBy(fields ...Field) SQLiteSelectQuery
GroupBy appends to the GroupByFields field in the SQLiteSelectQuery.
func (SQLiteSelectQuery) Having ¶
func (q SQLiteSelectQuery) Having(predicates ...Predicate) SQLiteSelectQuery
Having appends to the HavingPredicate field in the SQLiteSelectQuery.
func (SQLiteSelectQuery) IsArray ¶
func (q SQLiteSelectQuery) IsArray()
IsArray implements the Array interface.
func (SQLiteSelectQuery) IsBinary ¶
func (q SQLiteSelectQuery) IsBinary()
IsBinary implements the Binary interface.
func (SQLiteSelectQuery) IsBoolean ¶
func (q SQLiteSelectQuery) IsBoolean()
IsBoolean implements the Boolean interface.
func (SQLiteSelectQuery) IsEnum ¶
func (q SQLiteSelectQuery) IsEnum()
IsEnum implements the Enum interface.
func (SQLiteSelectQuery) IsField ¶
func (q SQLiteSelectQuery) IsField()
IsField implements the Field interface.
func (SQLiteSelectQuery) IsJSON ¶
func (q SQLiteSelectQuery) IsJSON()
IsJSON implements the JSON interface.
func (SQLiteSelectQuery) IsNumber ¶
func (q SQLiteSelectQuery) IsNumber()
IsNumber implements the Number interface.
func (SQLiteSelectQuery) IsString ¶
func (q SQLiteSelectQuery) IsString()
IsString implements the String interface.
func (SQLiteSelectQuery) IsTable ¶
func (q SQLiteSelectQuery) IsTable()
IsTable implements the Table interface.
func (SQLiteSelectQuery) IsTime ¶
func (q SQLiteSelectQuery) IsTime()
IsTime implements the Time interface.
func (SQLiteSelectQuery) IsUUID ¶
func (q SQLiteSelectQuery) IsUUID()
IsUUID implements the UUID interface.
func (SQLiteSelectQuery) Join ¶
func (q SQLiteSelectQuery) Join(table Table, predicates ...Predicate) SQLiteSelectQuery
Join joins a new Table to the SQLiteSelectQuery.
func (SQLiteSelectQuery) JoinUsing ¶
func (q SQLiteSelectQuery) JoinUsing(table Table, fields ...Field) SQLiteSelectQuery
JoinUsing joins a new Table to the SQLiteSelectQuery with the USING operator.
func (SQLiteSelectQuery) LeftJoin ¶
func (q SQLiteSelectQuery) LeftJoin(table Table, predicates ...Predicate) SQLiteSelectQuery
LeftJoin left joins a new Table to the SQLiteSelectQuery.
func (SQLiteSelectQuery) Limit ¶
func (q SQLiteSelectQuery) Limit(limit any) SQLiteSelectQuery
Limit sets the LimitRows field in the SQLiteSelectQuery.
func (SQLiteSelectQuery) Offset ¶
func (q SQLiteSelectQuery) Offset(offset any) SQLiteSelectQuery
Offset sets the OffsetRows field in the SQLiteSelectQuery.
func (SQLiteSelectQuery) OrderBy ¶
func (q SQLiteSelectQuery) OrderBy(fields ...Field) SQLiteSelectQuery
OrderBy appends to the OrderByFields field in the SQLiteSelectQuery.
func (SQLiteSelectQuery) Select ¶
func (q SQLiteSelectQuery) Select(fields ...Field) SQLiteSelectQuery
Select appends to the SelectFields in the SQLiteSelectQuery.
func (SQLiteSelectQuery) SelectDistinct ¶
func (q SQLiteSelectQuery) SelectDistinct(fields ...Field) SQLiteSelectQuery
SelectDistinct sets the SelectFields in the SQLiteSelectQuery.
func (SQLiteSelectQuery) SelectOne ¶
func (q SQLiteSelectQuery) SelectOne(fields ...Field) SQLiteSelectQuery
SelectOne sets the SQLiteSelectQuery to SELECT 1.
func (SQLiteSelectQuery) SetDialect ¶
func (q SQLiteSelectQuery) SetDialect(dialect string) SQLiteSelectQuery
SetDialect sets the dialect of the query.
func (SQLiteSelectQuery) SetFetchableFields ¶
func (q SQLiteSelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SQLiteSelectQuery) Where ¶
func (q SQLiteSelectQuery) Where(predicates ...Predicate) SQLiteSelectQuery
Where appends to the WherePredicate field in the SQLiteSelectQuery.
type SQLiteUpdateQuery ¶
type SQLiteUpdateQuery UpdateQuery
SQLiteUpdateQuery represents an SQLite UPDATE query.
func (SQLiteUpdateQuery) CrossJoin ¶
func (q SQLiteUpdateQuery) CrossJoin(table Table) SQLiteUpdateQuery
CrossJoin cross joins a new Table to the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) CustomJoin ¶
func (q SQLiteUpdateQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SQLiteUpdateQuery
CustomJoin joins a new Table to the SQLiteUpdateQuery with a custom join operator.
func (SQLiteUpdateQuery) From ¶
func (q SQLiteUpdateQuery) From(table Table) SQLiteUpdateQuery
From sets the FromTable field of the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) GetDialect ¶
func (q SQLiteUpdateQuery) GetDialect() string
GetDialect implements the Query interface.
func (SQLiteUpdateQuery) GetFetchableFields ¶
func (q SQLiteUpdateQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) Join ¶
func (q SQLiteUpdateQuery) Join(table Table, predicates ...Predicate) SQLiteUpdateQuery
Join joins a new Table to the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) JoinUsing ¶
func (q SQLiteUpdateQuery) JoinUsing(table Table, fields ...Field) SQLiteUpdateQuery
JoinUsing joins a new Table to the SQLiteUpdateQuery with the USING operator.
func (SQLiteUpdateQuery) LeftJoin ¶
func (q SQLiteUpdateQuery) LeftJoin(table Table, predicates ...Predicate) SQLiteUpdateQuery
LeftJoin left joins a new Table to the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) Returning ¶
func (q SQLiteUpdateQuery) Returning(fields ...Field) SQLiteUpdateQuery
Returning sets the ReturningFields field of the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) Set ¶
func (q SQLiteUpdateQuery) Set(assignments ...Assignment) SQLiteUpdateQuery
Set sets the Assignments field of the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) SetDialect ¶
func (q SQLiteUpdateQuery) SetDialect(dialect string) SQLiteUpdateQuery
SetDialect sets the dialect of the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) SetFetchableFields ¶
func (q SQLiteUpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SQLiteUpdateQuery) SetFunc ¶
func (q SQLiteUpdateQuery) SetFunc(colmapper func(*Column)) SQLiteUpdateQuery
SetFunc sets the ColumnMapper of the SQLiteUpdateQuery.
func (SQLiteUpdateQuery) Where ¶
func (q SQLiteUpdateQuery) Where(predicates ...Predicate) SQLiteUpdateQuery
Where appends to the WherePredicate field of the SQLiteUpdateQuery.
type SelectQuery ¶
type SelectQuery struct { Dialect string // WITH CTEs []CTE // SELECT Distinct bool SelectFields []Field DistinctOnFields []Field // TOP LimitTop any LimitTopPercent any // FROM FromTable Table // JOIN JoinTables []JoinTable // WHERE WherePredicate Predicate // GROUP BY GroupByFields []Field // HAVING HavingPredicate Predicate // WINDOW NamedWindows []NamedWindow // ORDER BY OrderByFields []Field // LIMIT LimitRows any // OFFSET OffsetRows any // FETCH NEXT FetchNextRows any FetchWithTies bool // FOR UPDATE | FOR SHARE LockClause string LockValues []any // AS Alias string Columns []string }
SelectQuery represents an SQL SELECT query.
func SelectDistinct ¶
func SelectDistinct(fields ...Field) SelectQuery
SelectDistinct creates a new SelectQuery.
func (SelectQuery) As ¶
func (q SelectQuery) As(alias string, columns ...string) SelectQuery
As returns a new SelectQuery with the table alias (and optionally column aliases).
func (SelectQuery) CrossJoin ¶
func (q SelectQuery) CrossJoin(table Table) SelectQuery
CrossJoin cross joins a new Table to the SelectQuery.
func (SelectQuery) CustomJoin ¶
func (q SelectQuery) CustomJoin(joinOperator string, table Table, predicates ...Predicate) SelectQuery
CustomJoin joins a new Table to the SelectQuery with a custom join operator.
func (SelectQuery) Field ¶
func (q SelectQuery) Field(name string) AnyField
Field returns a new field qualified by the SelectQuery's alias.
func (SelectQuery) From ¶
func (q SelectQuery) From(table Table) SelectQuery
From sets the FromTable field in the SelectQuery.
func (SelectQuery) GetAlias ¶
func (q SelectQuery) GetAlias() string
GetAlias returns the alias of the SelectQuery.
func (SelectQuery) GetColumns ¶
func (q SelectQuery) GetColumns() []string
GetColumns returns the column aliases of the SelectQuery.
func (SelectQuery) GetDialect ¶
func (q SelectQuery) GetDialect() string
GetDialect implements the Query interface.
func (SelectQuery) GetFetchableFields ¶
func (q SelectQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (SelectQuery) GroupBy ¶
func (q SelectQuery) GroupBy(fields ...Field) SelectQuery
GroupBy appends to the GroupByFields field in the SelectQuery.
func (SelectQuery) Having ¶
func (q SelectQuery) Having(predicates ...Predicate) SelectQuery
Having appends to the HavingPredicate field in the SelectQuery.
func (SelectQuery) IsBinary ¶
func (q SelectQuery) IsBinary()
IsBinary implements the Binary interface.
func (SelectQuery) IsBoolean ¶
func (q SelectQuery) IsBoolean()
IsBoolean implements the Boolean interface.
func (SelectQuery) IsNumber ¶
func (q SelectQuery) IsNumber()
IsNumber implements the Number interface.
func (SelectQuery) IsString ¶
func (q SelectQuery) IsString()
IsString implements the String interface.
func (SelectQuery) Join ¶
func (q SelectQuery) Join(table Table, predicates ...Predicate) SelectQuery
Join joins a new Table to the SelectQuery.
func (SelectQuery) JoinUsing ¶
func (q SelectQuery) JoinUsing(table Table, fields ...Field) SelectQuery
JoinUsing joins a new Table to the SelectQuery with the USING operator.
func (SelectQuery) LeftJoin ¶
func (q SelectQuery) LeftJoin(table Table, predicates ...Predicate) SelectQuery
LeftJoin left joins a new Table to the SelectQuery.
func (SelectQuery) Limit ¶
func (q SelectQuery) Limit(limit any) SelectQuery
Limit sets the LimitRows field in the SelectQuery.
func (SelectQuery) Offset ¶
func (q SelectQuery) Offset(offset any) SelectQuery
Offset sets the OffsetRows field in the SelectQuery.
func (SelectQuery) OrderBy ¶
func (q SelectQuery) OrderBy(fields ...Field) SelectQuery
OrderBy appends to the OrderByFields field in the SelectQuery.
func (SelectQuery) Select ¶
func (q SelectQuery) Select(fields ...Field) SelectQuery
Select appends to the SelectFields in the SelectQuery.
func (SelectQuery) SelectDistinct ¶
func (q SelectQuery) SelectDistinct(fields ...Field) SelectQuery
SelectDistinct sets the SelectFields in the SelectQuery.
func (SelectQuery) SelectOne ¶
func (q SelectQuery) SelectOne(fields ...Field) SelectQuery
SelectOne sets the SelectQuery to SELECT 1.
func (SelectQuery) SetDialect ¶
func (q SelectQuery) SetDialect(dialect string) SelectQuery
SetDialect sets the dialect of the query.
func (SelectQuery) SetFetchableFields ¶
func (q SelectQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (SelectQuery) Where ¶
func (q SelectQuery) Where(predicates ...Predicate) SelectQuery
Where appends to the WherePredicate field in the SelectQuery.
type SelectValues ¶
SelectValues represents a table literal comprised of SELECT statements UNION-ed together e.g.
(SELECT 1 AS a, 2 AS b, 3 AS c UNION ALL SELECT 4, 5, 6 UNION ALL SELECT 7, 8, 9) AS tbl
func (SelectValues) Field ¶
func (vs SelectValues) Field(name string) AnyField
Field returns a new field qualified by the SelectValues' alias.
func (SelectValues) GetAlias ¶
func (vs SelectValues) GetAlias() string
GetAlias returns the alias of the SelectValues.
func (SelectValues) GetDialect ¶
func (vs SelectValues) GetDialect() string
GetDialect implements the Query interface. It always returns an empty string.
func (SelectValues) GetFetchableFields ¶
func (vs SelectValues) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the SelectValues.
func (SelectValues) IsTable ¶
func (vs SelectValues) IsTable()
IsTable implements the Table interface.
func (SelectValues) SetFetchableFields ¶
func (vs SelectValues) SetFetchableFields([]Field) (query Query, ok bool)
SetFetchableFields implements the Query interface. It always returns false as the second result.
type SimpleCase ¶
SimpleCase holds the result to be used for a given value in a SimpleCaseExpression.
type SimpleCaseExpression ¶
type SimpleCaseExpression struct { Expression any Cases SimpleCases Default any // contains filtered or unexported fields }
SimpleCaseExpression represents an SQL simple CASE expression.
func (SimpleCaseExpression) As ¶
func (e SimpleCaseExpression) As(alias string) SimpleCaseExpression
As returns a new SimpleCaseExpression with the given alias.
func (SimpleCaseExpression) Else ¶
func (e SimpleCaseExpression) Else(fallback any) SimpleCaseExpression
Else sets the fallback result of the SimpleCaseExpression.
func (SimpleCaseExpression) GetAlias ¶
func (e SimpleCaseExpression) GetAlias() string
GetAlias returns the alias of the SimpleCaseExpression.
func (SimpleCaseExpression) IsArray ¶
func (e SimpleCaseExpression) IsArray()
IsArray implements the Array interface.
func (SimpleCaseExpression) IsBinary ¶
func (e SimpleCaseExpression) IsBinary()
IsBinary implements the Binary interface.
func (SimpleCaseExpression) IsBoolean ¶
func (e SimpleCaseExpression) IsBoolean()
IsBoolean implements the Boolean interface.
func (SimpleCaseExpression) IsEnum ¶
func (e SimpleCaseExpression) IsEnum()
IsEnum implements the Enum interface.
func (SimpleCaseExpression) IsField ¶
func (e SimpleCaseExpression) IsField()
IsField implements the Field interface.
func (SimpleCaseExpression) IsJSON ¶
func (e SimpleCaseExpression) IsJSON()
IsJSON implements the JSON interface.
func (SimpleCaseExpression) IsNumber ¶
func (e SimpleCaseExpression) IsNumber()
IsNumber implements the Number interface.
func (SimpleCaseExpression) IsString ¶
func (e SimpleCaseExpression) IsString()
IsString implements the String interface.
func (SimpleCaseExpression) IsTime ¶
func (e SimpleCaseExpression) IsTime()
IsTime implements the Time interface.
func (SimpleCaseExpression) IsUUID ¶
func (e SimpleCaseExpression) IsUUID()
IsUUID implements the UUID interface.
func (SimpleCaseExpression) When ¶
func (e SimpleCaseExpression) When(value any, result any) SimpleCaseExpression
When adds a new value-result pair to the SimpleCaseExpression.
type SqLogger ¶
type SqLogger interface { // SqLogSettings should populate a LogSettings struct, which influences // what is added into the QueryStats. SqLogSettings(context.Context, *LogSettings) // SqLogQuery logs a query when for the given QueryStats. SqLogQuery(context.Context, QueryStats) }
SqLogger represents a logger for the sq package.
type StringField ¶
type StringField struct {
// contains filtered or unexported fields
}
StringField represents an SQL string field.
func NewStringField ¶
func NewStringField(name string, tbl TableStruct) StringField
NewStringField returns a new StringField.
func (StringField) As ¶
func (f StringField) As(alias string) StringField
As returns a new StringField with the given alias.
func (StringField) Asc ¶
func (f StringField) Asc() StringField
Asc returns a new StringField indicating that it should be ordered in ascending order i.e. 'ORDER BY field ASC'.
func (StringField) Collate ¶
func (f StringField) Collate(collation string) StringField
Collate returns a new StringField using the given collation.
func (StringField) Desc ¶
func (f StringField) Desc() StringField
Desc returns a new StringField indicating that it should be ordered in descending order i.e. 'ORDER BY field DESC'.
func (StringField) Eq ¶
func (f StringField) Eq(val String) Predicate
Eq returns a 'field = val' Predicate.
func (StringField) EqString ¶
func (f StringField) EqString(s string) Predicate
EqString returns a 'field = s' Predicate.
func (StringField) Ge ¶
func (f StringField) Ge(val String) Predicate
Ge returns a 'field >= val' Predicate.
func (StringField) GeString ¶
func (f StringField) GeString(s string) Predicate
GeString returns a 'field >= s' Predicate.
func (StringField) GetAlias ¶
func (f StringField) GetAlias() string
GetAlias returns the alias of the StringField.
func (StringField) Gt ¶
func (f StringField) Gt(val String) Predicate
Gt returns a 'field > val' Predicate.
func (StringField) GtString ¶
func (f StringField) GtString(s string) Predicate
GtString returns a 'field > s' Predicate.
func (StringField) ILikeString ¶
func (f StringField) ILikeString(s string) Predicate
LikeString returns a 'field ILIKE s' Predicate.
func (StringField) In ¶
func (f StringField) In(val any) Predicate
In returns a 'field IN (val)' Predicate.
func (StringField) IsNotNull ¶
func (f StringField) IsNotNull() Predicate
IsNotNull returns a 'field IS NOT NULL' Predicate.
func (StringField) IsNull ¶
func (f StringField) IsNull() Predicate
IsNull returns a 'field IS NULL' Predicate.
func (StringField) IsString ¶
func (f StringField) IsString()
IsString implements the String interface.
func (StringField) Le ¶
func (f StringField) Le(val String) Predicate
Le returns a 'field <= val' Predicate.
func (StringField) LeString ¶
func (f StringField) LeString(s string) Predicate
LeString returns a 'field <= s' Predicate.
func (StringField) LikeString ¶
func (f StringField) LikeString(s string) Predicate
LikeString returns a 'field LIKE s' Predicate.
func (StringField) Lt ¶
func (f StringField) Lt(val String) Predicate
Lt returns a 'field < val' Predicate.
func (StringField) LtString ¶
func (f StringField) LtString(s string) Predicate
LtString returns a 'field < s' Predicate.
func (StringField) Ne ¶
func (f StringField) Ne(val String) Predicate
Ne returns a 'field <> val' Predicate.
func (StringField) NeString ¶
func (f StringField) NeString(s string) Predicate
NeString returns a 'field <> s' Predicate.
func (StringField) NullsFirst ¶
func (f StringField) NullsFirst() StringField
NullsFirst returns a new StringField indicating that it should be ordered with nulls first i.e. 'ORDER BY field NULLS FIRST'.
func (StringField) NullsLast ¶
func (f StringField) NullsLast() StringField
NullsLast returns a new StringField indicating that it should be ordered with nulls last i.e. 'ORDER BY field NULLS LAST'.
func (StringField) Set ¶
func (f StringField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (StringField) SetString ¶
func (f StringField) SetString(s string) Assignment
SetBytes returns an Assignment assigning a string to the field.
func (StringField) Setf ¶
func (f StringField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (StringField) WithPrefix ¶
func (f StringField) WithPrefix(prefix string) Field
WithPrefix returns a new Field that with the given prefix.
type StringParameter ¶
StringParameter functions as an sql.NamedArg, but implements the String interface.
func StringParam ¶
func StringParam(name string, s string) StringParameter
StringParam creates a new StringParameter from a string value.
func (StringParameter) GetAlias ¶
func (p StringParameter) GetAlias() string
GetAlias implements the Field interface.
func (StringParameter) IsField ¶
func (p StringParameter) IsField()
IsField implements the Field interface.
func (StringParameter) IsString ¶
func (p StringParameter) IsString()
IsString implements the String interface.
type Table ¶
type Table interface { SQLWriter IsTable() }
Table is anything you can Select from or Join.
type TableStruct ¶
type TableStruct struct {
// contains filtered or unexported fields
}
TableStruct is meant to be embedded in table structs to make them implement the Table interface.
func NewTableStruct ¶
func NewTableStruct(schema, name, alias string) TableStruct
NewTableStruct creates a new TableStruct.
func (TableStruct) GetAlias ¶
func (ts TableStruct) GetAlias() string
GetAlias returns the alias of the TableStruct.
func (TableStruct) IsTable ¶
func (ts TableStruct) IsTable()
IsTable implements the Table interface.
type TableValues ¶
TableValues represents a table literal created by the VALUES clause e.g.
(VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9)) AS tbl (a, b, c)
func (TableValues) Field ¶
func (vs TableValues) Field(name string) AnyField
Field returns a new field qualified by the TableValues' alias.
func (TableValues) GetAlias ¶
func (vs TableValues) GetAlias() string
GetAlias returns the alias of the TableValues.
func (TableValues) GetColumns ¶
func (vs TableValues) GetColumns() []string
GetColumns returns the names of the columns in the TableValues.
func (TableValues) GetDialect ¶
func (vs TableValues) GetDialect() string
GetDialect implements the Query interface. It always returns an empty string.
func (TableValues) GetFetchableFields ¶
func (vs TableValues) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the TableValues.
func (TableValues) IsTable ¶
func (vs TableValues) IsTable()
IsTable implements the Table interface.
func (TableValues) SetFetchableFields ¶
func (vs TableValues) SetFetchableFields([]Field) (query Query, ok bool)
SetFetchableFields implements the Query interface. It always returns false as the second result.
type TimeField ¶
type TimeField struct {
// contains filtered or unexported fields
}
TimeField represents an SQL time field.
func NewTimeField ¶
func NewTimeField(name string, tbl TableStruct) TimeField
NewTimeField returns a new TimeField.
func (TimeField) Asc ¶
Asc returns a new TimeField indicating that it should be ordered in ascending order i.e. 'ORDER BY field ASC'.
func (TimeField) Desc ¶
Desc returns a new TimeField indicating that it should be ordered in ascending order i.e. 'ORDER BY field DESC'.
func (TimeField) NullsFirst ¶
NullsFirst returns a new TimeField indicating that it should be ordered with nulls first i.e. 'ORDER BY field NULLS FIRST'.
func (TimeField) NullsLast ¶
NullsLast returns a new TimeField indicating that it should be ordered with nulls last i.e. 'ORDER BY field NULLS LAST'.
func (TimeField) Set ¶
func (f TimeField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (TimeField) SetTime ¶
func (f TimeField) SetTime(t time.Time) Assignment
SetTime returns an Assignment assigning a time.Time to the field.
func (TimeField) SetTimestamp ¶
func (f TimeField) SetTimestamp(t Timestamp) Assignment
SetTimestamp returns an Assignment assigning a Timestamp to the field.
func (TimeField) Setf ¶
func (f TimeField) Setf(format string, values ...any) Assignment
Setf returns an Assignment assigning an expression to the field.
func (TimeField) WithPrefix ¶
WithPrefix returns a new Field that with the given prefix.
type TimeParameter ¶
TimeParameter functions as an sql.NamedArg, but implements the Time interface.
func TimeParam ¶
func TimeParam(name string, t time.Time) TimeParameter
TimeParam creates a new TimeParameter from a time.Time value.
func (TimeParameter) GetAlias ¶
func (p TimeParameter) GetAlias() string
GetAlias implements the Field interface.
func (TimeParameter) IsField ¶
func (p TimeParameter) IsField()
IsField implements the Field interface.
type Timestamp ¶
Timestamp is like sql.NullTime but implements the DialectValuer interface. When the dialect is SQLite, Timestamp will render itself an an int64 unix time. Otherwise, it behaves similarly to an sql.NullTime.
func NewTimestamp ¶
NewTimestamp creates a new Timestamp from a time.Time.
func (Timestamp) DialectValuer ¶
DialectValuer implements the DialectValuer interface.
type UUIDField ¶
type UUIDField struct {
// contains filtered or unexported fields
}
UUIDField represents an SQL UUID field.
func NewUUIDField ¶
func NewUUIDField(name string, tbl TableStruct) UUIDField
NewUUIDField returns a new UUIDField.
func (UUIDField) Asc ¶
Asc returns a new UUIDField indicating that it should be ordered in ascending order i.e. 'ORDER BY field ASC'.
func (UUIDField) Desc ¶
Desc returns a new UUIDField indicating that it should be ordered in ascending order i.e. 'ORDER BY field DESC'.
func (UUIDField) Eq ¶
Eq returns a 'field = val' Predicate. The value is passed as-is to the database.
func (UUIDField) Ne ¶
Ne returns a 'field <> val' Predicate. The value is passed as-is to the database.
func (UUIDField) NullsFirst ¶
NullsFirst returns a new UUIDField indicating that it should be ordered with nulls first i.e. 'ORDER BY field NULLS FIRST'.
func (UUIDField) NullsLast ¶
NullsLast returns a new UUIDField indicating that it should be ordered with nulls last i.e. 'ORDER BY field NULLS LAST'.
func (UUIDField) Set ¶
func (f UUIDField) Set(val any) Assignment
Set returns an Assignment assigning the val to the field.
func (UUIDField) SetUUID ¶
func (f UUIDField) SetUUID(val any) Assignment
SetUUID is like Set but it wraps val with the UUIDValue() constructor.
func (UUIDField) Setf ¶
func (f UUIDField) Setf(format string, values ...any) Assignment
Set returns an Assignment assigning the val to the field.
func (UUIDField) WithPrefix ¶
WithPrefix returns a new Field that with the given prefix.
type UpdateQuery ¶
type UpdateQuery struct { Dialect string ColumnMapper func(*Column) // WITH CTEs []CTE // UPDATE UpdateTable Table // FROM FromTable Table JoinTables []JoinTable // SET Assignments []Assignment // WHERE WherePredicate Predicate // ORDER BY OrderByFields []Field // LIMIT LimitRows any // RETURNING ReturningFields []Field }
UpdateQuery represents an SQL UPDATE query.
func (UpdateQuery) GetDialect ¶
func (q UpdateQuery) GetDialect() string
GetDialect implements the Query interface.
func (UpdateQuery) GetFetchableFields ¶
func (q UpdateQuery) GetFetchableFields() []Field
GetFetchableFields returns the fetchable fields of the query.
func (UpdateQuery) Set ¶
func (q UpdateQuery) Set(assignments ...Assignment) UpdateQuery
Set sets the Assignments field of the UpdateQuery.
func (UpdateQuery) SetDialect ¶
func (q UpdateQuery) SetDialect(dialect string) UpdateQuery
SetDialect sets the dialect of the query.
func (UpdateQuery) SetFetchableFields ¶
func (q UpdateQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
func (UpdateQuery) SetFunc ¶
func (q UpdateQuery) SetFunc(colmapper func(*Column)) UpdateQuery
SetFunc sets the ColumnMapper field of the UpdateQuery.
func (UpdateQuery) Where ¶
func (q UpdateQuery) Where(predicates ...Predicate) UpdateQuery
Where appends to the WherePredicate field of the UpdateQuery.
type ValueExpression ¶
type ValueExpression struct {
// contains filtered or unexported fields
}
ValueExpression represents an SQL value that is passed in as an argument to a prepared query.
func (ValueExpression) As ¶
func (e ValueExpression) As(alias string) ValueExpression
As returns a new ValueExpression with the given alias.
func (ValueExpression) Eq ¶
func (e ValueExpression) Eq(val any) Predicate
Eq returns a 'expr = val' Predicate.
func (ValueExpression) Ge ¶
func (e ValueExpression) Ge(val any) Predicate
Ge returns a 'expr >= val' Predicate.
func (ValueExpression) GetAlias ¶
func (e ValueExpression) GetAlias() string
GetAlias returns the alias of the ValueExpression.
func (ValueExpression) Gt ¶
func (e ValueExpression) Gt(val any) Predicate
Gt returns a 'expr > val' Predicate.
func (ValueExpression) In ¶
func (e ValueExpression) In(val any) Predicate
In returns a 'expr IN (val)' Predicate.
func (ValueExpression) IsArray ¶
func (e ValueExpression) IsArray()
IsArray implements the Array interface.
func (ValueExpression) IsBinary ¶
func (e ValueExpression) IsBinary()
IsBinary implements the Binary interface.
func (ValueExpression) IsBoolean ¶
func (e ValueExpression) IsBoolean()
IsBoolean implements the Boolean interface.
func (ValueExpression) IsEnum ¶
func (e ValueExpression) IsEnum()
IsEnum implements the Enum interface.
func (ValueExpression) IsField ¶
func (e ValueExpression) IsField()
IsField implements the Field interface.
func (ValueExpression) IsJSON ¶
func (e ValueExpression) IsJSON()
IsJSON implements the JSON interface.
func (ValueExpression) IsNumber ¶
func (e ValueExpression) IsNumber()
IsNumber implements the Number interface.
func (ValueExpression) IsString ¶
func (e ValueExpression) IsString()
IsString implements the String interface.
func (ValueExpression) IsTime ¶
func (e ValueExpression) IsTime()
IsTime implements the Time interfaces.
func (ValueExpression) IsUUID ¶
func (e ValueExpression) IsUUID()
IsUUID implements the UUID interface.
func (ValueExpression) Le ¶
func (e ValueExpression) Le(val any) Predicate
Le returns a 'expr <= val' Predicate.
func (ValueExpression) Lt ¶
func (e ValueExpression) Lt(val any) Predicate
Lt returns a 'expr < val' Predicate.
func (ValueExpression) Ne ¶
func (e ValueExpression) Ne(val any) Predicate
Ne returns a 'expr <> val' Predicate.
type VariadicPredicate ¶
type VariadicPredicate struct { // Toplevel indicates if the VariadicPredicate can skip writing the // (surrounding brackets). Toplevel bool // If IsDisjunction is true, the Predicates are joined using OR. If false, // the Predicates are joined using AND. The default is AND. IsDisjunction bool // Predicates holds the predicates inside the VariadicPredicate Predicates []Predicate // contains filtered or unexported fields }
VariadicPredicate represents the 'x AND y AND z...' or 'x OR Y OR z...' SQL construct.
func And ¶
func And(predicates ...Predicate) VariadicPredicate
And joins the predicates together with the AND operator.
func Or ¶
func Or(predicates ...Predicate) VariadicPredicate
Or joins the predicates together with the OR operator.
func (VariadicPredicate) As ¶
func (p VariadicPredicate) As(alias string) VariadicPredicate
As returns a new VariadicPredicate with the given alias.
func (VariadicPredicate) GetAlias ¶
func (p VariadicPredicate) GetAlias() string
GetAlias returns the alias of the VariadicPredicate.
func (VariadicPredicate) IsBoolean ¶
func (p VariadicPredicate) IsBoolean()
AssertBooleanType implements the Predicate interface.
func (VariadicPredicate) IsField ¶
func (p VariadicPredicate) IsField()
AssertField implements the Field interface.
type VariadicQuery ¶
type VariadicQuery struct { Toplevel bool Operator VariadicQueryOperator Queries []Query }
VariadicQuery represents the 'x UNION y UNION z...' etc SQL constructs.
func Except ¶
func Except(queries ...Query) VariadicQuery
Except joins the queries together with the EXCEPT operator.
func ExceptAll ¶
func ExceptAll(queries ...Query) VariadicQuery
ExceptAll joins the queries together with the EXCEPT ALL operator.
func Intersect ¶
func Intersect(queries ...Query) VariadicQuery
Intersect joins the queries together with the INTERSECT operator.
func IntersectAll ¶
func IntersectAll(queries ...Query) VariadicQuery
IntersectAll joins the queries together with the INTERSECT ALL operator.
func Union ¶
func Union(queries ...Query) VariadicQuery
Union joins the queries together with the UNION operator.
func UnionAll ¶
func UnionAll(queries ...Query) VariadicQuery
UnionAll joins the queries together with the UNION ALL operator.
func (VariadicQuery) GetDialect ¶
func (q VariadicQuery) GetDialect() string
GetDialect returns the SQL dialect of the VariadicQuery.
func (VariadicQuery) GetFetchableFields ¶
func (q VariadicQuery) GetFetchableFields() []Field
GetFetchableFields implements the Query interface.
func (VariadicQuery) SetFetchableFields ¶
func (q VariadicQuery) SetFetchableFields(fields []Field) (query Query, ok bool)
SetFetchableFields implements the Query interface.
type VariadicQueryOperator ¶
type VariadicQueryOperator string
VariadicQueryOperator represents a variadic query operator.
const ( QueryUnion VariadicQueryOperator = "UNION" QueryUnionAll VariadicQueryOperator = "UNION ALL" QueryIntersect VariadicQueryOperator = "INTERSECT" QueryIntersectAll VariadicQueryOperator = "INTERSECT ALL" QueryExcept VariadicQueryOperator = "EXCEPT" QueryExceptAll VariadicQueryOperator = "EXCEPT ALL" )
VariadicQuery operators.
type Window ¶
type Window interface { SQLWriter IsWindow() }
Window is a window used in SQL window functions.
type WindowDefinition ¶
type WindowDefinition struct { BaseWindowName string PartitionByFields []Field OrderByFields []Field FrameSpec string FrameValues []any }
WindowDefinition represents an SQL window definition.
func BaseWindow ¶
func BaseWindow(w NamedWindow) WindowDefinition
BaseWindow creates a new WindowDefinition based off an existing NamedWindow.
func OrderBy ¶
func OrderBy(fields ...Field) WindowDefinition
PartitionBy returns a new WindowDefinition with the ORDER BY clause.
func PartitionBy ¶
func PartitionBy(fields ...Field) WindowDefinition
PartitionBy returns a new WindowDefinition with the PARTITION BY clause.
func (WindowDefinition) Frame ¶
func (w WindowDefinition) Frame(frameSpec string, frameValues ...any) WindowDefinition
Frame returns a new WindowDefinition with the frame specification set.
func (WindowDefinition) IsWindow ¶
func (w WindowDefinition) IsWindow()
IsWindow implements the Window interface.
func (WindowDefinition) OrderBy ¶
func (w WindowDefinition) OrderBy(fields ...Field) WindowDefinition
OrderBy returns a new WindowDefinition with the ORDER BY clause.
func (WindowDefinition) PartitionBy ¶
func (w WindowDefinition) PartitionBy(fields ...Field) WindowDefinition
PartitionBy returns a new WindowDefinition with the PARTITION BY clause.