Versions in this module Expand all Collapse all v1 v1.0.0 Mar 21, 2023 Changes in this version + const DEFAULT + const NOW + var EnableInterpolation = false + var ErrArgumentMismatch = errors.New("mismatch between ? (placeholders) and arguments") + var ErrInvalidOperation = errors.New("invalid operation") + var ErrInvalidSliceLength = errors.New("length of slice is 0. length must be >= 1") + var ErrInvalidSliceValue = errors.New("trying to interpolate invalid slice value into query") + var ErrInvalidValue = errors.New("trying to interpolate invalid value into query") + var ErrNotFound = errors.New("not found") + var ErrNotUTF8 = errors.New("invalid UTF-8") + var ErrTimedout = errors.New("query timed out") + var NameMapping = camelCaseToSnakeCase + var Strict = false + func Interpolate(sql string, vals []interface{}) (string, []interface{}, error) + func ParseDir(dir string, version string) error + func ParseSprocName(s string) string + func PartitionKV(r io.Reader, prefix string, assignment string) ([]map[string]string, error) + func SQLMapFromFile(filename string) (map[string]string, error) + func SQLMapFromReader(r io.Reader) (map[string]string, error) + func SQLMapFromString(s string) (map[string]string, error) + func SQLSliceFromFile(filename string) ([]string, error) + func SQLSliceFromString(s string) ([]string, error) + type Builder interface + Interpolate func() (string, []interface{}, error) + IsInterpolated func() bool + ToSQL func() (string, []interface{}) + type CallBuilder struct + func Call(sproc string, args ...interface{}) *CallBuilder + func NewCallBuilder(sproc string, args ...interface{}) *CallBuilder + func (b *CallBuilder) Interpolate() (string, []interface{}, error) + func (b *CallBuilder) IsInterpolated() bool + func (b *CallBuilder) SetIsInterpolated(enable bool) *CallBuilder + func (b *CallBuilder) ToSQL() (string, []interface{}) + type DeleteBuilder struct + func DeleteFrom(table string) *DeleteBuilder + func NewDeleteBuilder(table string) *DeleteBuilder + func (b *DeleteBuilder) Interpolate() (string, []interface{}, error) + func (b *DeleteBuilder) IsInterpolated() bool + func (b *DeleteBuilder) Scope(sql string, args ...interface{}) *DeleteBuilder + func (b *DeleteBuilder) ScopeMap(mapScope *MapScope, m M) *DeleteBuilder + func (b *DeleteBuilder) SetIsInterpolated(enable bool) *DeleteBuilder + func (b *DeleteBuilder) ToSQL() (string, []interface{}) + func (b *DeleteBuilder) Where(whereSQLOrMap interface{}, args ...interface{}) *DeleteBuilder + type Eq map[string]interface + type Execer interface + Cache func(id string, ttl time.Duration, invalidate bool) Execer + Exec func() (*Result, error) + Interpolate func() (string, []interface{}, error) + QueryJSON func() ([]byte, error) + QueryObject func(dest interface{}) error + QueryScalar func(destinations ...interface{}) error + QuerySlice func(dest interface{}) error + QueryStruct func(dest interface{}) error + QueryStructs func(dest interface{}) error + Timeout func(time.Duration) Execer + type Expression struct + Args []interface{} + Sql string + func Expr(sql string, values ...interface{}) *Expression + func (exp *Expression) Expression() (string, []interface{}, error) + func (exp *Expression) WriteRelativeArgs(buf common.BufferWriter, args *[]interface{}, pos *int64) + type Expressioner interface + Expression func() (string, []interface{}, error) + type InsectBuilder struct + func Insect(table string) *InsectBuilder + func NewInsectBuilder(table string) *InsectBuilder + func (b *InsectBuilder) Blacklist(columns ...string) *InsectBuilder + func (b *InsectBuilder) Columns(columns ...string) *InsectBuilder + func (b *InsectBuilder) Interpolate() (string, []interface{}, error) + func (b *InsectBuilder) IsInterpolated() bool + func (b *InsectBuilder) Record(record interface{}) *InsectBuilder + func (b *InsectBuilder) Returning(columns ...string) *InsectBuilder + func (b *InsectBuilder) SetIsInterpolated(enable bool) *InsectBuilder + func (b *InsectBuilder) ToSQL() (string, []interface{}) + func (b *InsectBuilder) Values(vals ...interface{}) *InsectBuilder + func (b *InsectBuilder) Where(whereSQLOrMap interface{}, args ...interface{}) *InsectBuilder + func (b *InsectBuilder) Whitelist(columns ...string) *InsectBuilder + type InsertBuilder struct + func InsertInto(table string) *InsertBuilder + func NewInsertBuilder(table string) *InsertBuilder + func (b *InsertBuilder) Blacklist(columns ...string) *InsertBuilder + func (b *InsertBuilder) Columns(columns ...string) *InsertBuilder + func (b *InsertBuilder) Interpolate() (string, []interface{}, error) + func (b *InsertBuilder) IsInterpolated() bool + func (b *InsertBuilder) Pair(column string, value interface{}) *InsertBuilder + func (b *InsertBuilder) Record(record interface{}) *InsertBuilder + func (b *InsertBuilder) Returning(columns ...string) *InsertBuilder + func (b *InsertBuilder) SetIsInterpolated(enable bool) *InsertBuilder + func (b *InsertBuilder) ToSQL() (string, []interface{}) + func (b *InsertBuilder) Values(vals ...interface{}) *InsertBuilder + func (b *InsertBuilder) Whitelist(columns ...string) *InsertBuilder + type Interpolator interface + Interpolate func() (string, error) + type JSON json.RawMessage + func JSONFromString(encoded string) JSON + func NewJSON(any interface{}) (*JSON, error) + func (j *JSON) Scan(src interface{}) error + func (j *JSON) Unmarshal(v interface{}) error + func (j *JSON) UnmarshalJSON(data []byte) error + func (j JSON) Interpolate() (string, error) + func (j JSON) MarshalJSON() ([]byte, error) + func (j JSON) Value() (driver.Value, error) + type M map[string]interface + type MapScope struct + Fields M + SQL string + func NewScope(sql string, fields M) *MapScope + func (scope *MapScope) ToSQL(table string) (string, []interface{}) + type NullBool struct + func NullBoolFrom(v bool) NullBool + func (n *NullBool) UnmarshalJSON(b []byte) error + func (n NullBool) MarshalJSON() ([]byte, error) + type NullFloat64 struct + func NullFloat64From(v float64) NullFloat64 + func (n *NullFloat64) UnmarshalJSON(b []byte) error + func (n NullFloat64) MarshalJSON() ([]byte, error) + type NullInt64 struct + func NullInt64From(v int64) NullInt64 + func (n *NullInt64) UnmarshalJSON(b []byte) error + func (n NullInt64) MarshalJSON() ([]byte, error) + type NullString struct + func NullStringFrom(v string) NullString + func (n *NullString) UnmarshalJSON(b []byte) error + func (n NullString) MarshalJSON() ([]byte, error) + type NullTime struct + func NullTimeFrom(v time.Time) NullTime + func (n *NullTime) UnmarshalJSON(b []byte) error + func (n NullTime) MarshalJSON() ([]byte, error) + type RawBuilder struct + func NewRawBuilder(sql string, args ...interface{}) *RawBuilder + func SQL(sql string, args ...interface{}) *RawBuilder + func (b *RawBuilder) Interpolate() (string, []interface{}, error) + func (b *RawBuilder) IsInterpolated() bool + func (b *RawBuilder) SetIsInterpolated(enable bool) *RawBuilder + func (b *RawBuilder) ToSQL() (string, []interface{}) + type Result struct + LastInsertID int64 + RowsAffected int64 + type SQLDialect interface + WriteFormattedTime func(buf common.BufferWriter, t time.Time) + WriteIdentifier func(buf common.BufferWriter, column string) + WriteStringLiteral func(buf common.BufferWriter, value string) + var Dialect SQLDialect + type Scope interface + ToSQL func(table string) (string, []interface{}) + type ScopeFunc func(table string) (string, []interface{}) + func (sf ScopeFunc) ToSQL(table string) (string, []interface{}) + type SelectBuilder struct + func NewSelectBuilder(columns ...string) *SelectBuilder + func Select(columns ...string) *SelectBuilder + func (b *SelectBuilder) Columns(columns ...string) *SelectBuilder + func (b *SelectBuilder) Distinct() *SelectBuilder + func (b *SelectBuilder) DistinctOn(columns ...string) *SelectBuilder + func (b *SelectBuilder) For(options ...string) *SelectBuilder + func (b *SelectBuilder) From(from string) *SelectBuilder + func (b *SelectBuilder) GroupBy(group string) *SelectBuilder + func (b *SelectBuilder) Having(whereSQLOrMap interface{}, args ...interface{}) *SelectBuilder + func (b *SelectBuilder) Interpolate() (string, []interface{}, error) + func (b *SelectBuilder) IsInterpolated() bool + func (b *SelectBuilder) Limit(limit uint64) *SelectBuilder + func (b *SelectBuilder) Offset(offset uint64) *SelectBuilder + func (b *SelectBuilder) OrderBy(whereSQLOrMap interface{}, args ...interface{}) *SelectBuilder + func (b *SelectBuilder) Paginate(page, perPage uint64) *SelectBuilder + func (b *SelectBuilder) Scope(sql string, args ...interface{}) *SelectBuilder + func (b *SelectBuilder) ScopeMap(mapScope *MapScope, m M) *SelectBuilder + func (b *SelectBuilder) SetIsInterpolated(enable bool) *SelectBuilder + func (b *SelectBuilder) ToSQL() (string, []interface{}) + func (b *SelectBuilder) Where(whereSQLOrMap interface{}, args ...interface{}) *SelectBuilder + type SelectDocBuilder struct + func NewSelectDocBuilder(columns ...string) *SelectDocBuilder + func SelectDoc(columns ...string) *SelectDocBuilder + func (b *SelectDocBuilder) Columns(columns ...string) *SelectDocBuilder + func (b *SelectDocBuilder) Distinct() *SelectDocBuilder + func (b *SelectDocBuilder) DistinctOn(columns ...string) *SelectDocBuilder + func (b *SelectDocBuilder) For(options ...string) *SelectDocBuilder + func (b *SelectDocBuilder) From(from string) *SelectDocBuilder + func (b *SelectDocBuilder) GroupBy(group string) *SelectDocBuilder + func (b *SelectDocBuilder) Having(whereSQLOrMap interface{}, args ...interface{}) *SelectDocBuilder + func (b *SelectDocBuilder) InnerSQL(sql string, a ...interface{}) *SelectDocBuilder + func (b *SelectDocBuilder) Interpolate() (string, []interface{}, error) + func (b *SelectDocBuilder) IsInterpolated() bool + func (b *SelectDocBuilder) Limit(limit uint64) *SelectDocBuilder + func (b *SelectDocBuilder) Many(column string, sqlOrBuilder interface{}, a ...interface{}) *SelectDocBuilder + func (b *SelectDocBuilder) Offset(offset uint64) *SelectDocBuilder + func (b *SelectDocBuilder) One(column string, sqlOrBuilder interface{}, a ...interface{}) *SelectDocBuilder + func (b *SelectDocBuilder) OrderBy(whereSQLOrMap interface{}, args ...interface{}) *SelectDocBuilder + func (b *SelectDocBuilder) Paginate(page, perPage uint64) *SelectDocBuilder + func (b *SelectDocBuilder) Scope(sql string, args ...interface{}) *SelectDocBuilder + func (b *SelectDocBuilder) ScopeMap(mapScope *MapScope, m M) *SelectDocBuilder + func (b *SelectDocBuilder) SetIsInterpolated(enable bool) *SelectDocBuilder + func (b *SelectDocBuilder) ToSQL() (string, []interface{}) + func (b *SelectDocBuilder) Where(whereSQLOrMap interface{}, args ...interface{}) *SelectDocBuilder + type UnsafeString string + func (u UnsafeString) Value() (driver.Value, error) + type UpdateBuilder struct + func NewUpdateBuilder(table string) *UpdateBuilder + func Update(table string) *UpdateBuilder + func (b *UpdateBuilder) Interpolate() (string, []interface{}, error) + func (b *UpdateBuilder) IsInterpolated() bool + func (b *UpdateBuilder) Limit(limit uint64) *UpdateBuilder + func (b *UpdateBuilder) Offset(offset uint64) *UpdateBuilder + func (b *UpdateBuilder) OrderBy(ord string) *UpdateBuilder + func (b *UpdateBuilder) Returning(columns ...string) *UpdateBuilder + func (b *UpdateBuilder) Scope(sql string, args ...interface{}) *UpdateBuilder + func (b *UpdateBuilder) ScopeMap(mapScope *MapScope, m M) *UpdateBuilder + func (b *UpdateBuilder) Set(column string, value interface{}) *UpdateBuilder + func (b *UpdateBuilder) SetBlacklist(rec interface{}, blacklist ...string) *UpdateBuilder + func (b *UpdateBuilder) SetIsInterpolated(enable bool) *UpdateBuilder + func (b *UpdateBuilder) SetMap(clauses map[string]interface{}) *UpdateBuilder + func (b *UpdateBuilder) SetWhitelist(rec interface{}, whitelist ...string) *UpdateBuilder + func (b *UpdateBuilder) ToSQL() (string, []interface{}) + func (b *UpdateBuilder) Where(whereSQLOrMap interface{}, args ...interface{}) *UpdateBuilder + type UpsertBuilder struct + func NewUpsertBuilder(table string) *UpsertBuilder + func Upsert(table string) *UpsertBuilder + func (b *UpsertBuilder) Blacklist(columns ...string) *UpsertBuilder + func (b *UpsertBuilder) Columns(columns ...string) *UpsertBuilder + func (b *UpsertBuilder) Interpolate() (string, []interface{}, error) + func (b *UpsertBuilder) IsInterpolated() bool + func (b *UpsertBuilder) Record(record interface{}) *UpsertBuilder + func (b *UpsertBuilder) Returning(columns ...string) *UpsertBuilder + func (b *UpsertBuilder) SetIsInterpolated(enable bool) *UpsertBuilder + func (b *UpsertBuilder) ToSQL() (string, []interface{}) + func (b *UpsertBuilder) Values(vals ...interface{}) *UpsertBuilder + func (b *UpsertBuilder) Where(whereSQLOrMap interface{}, args ...interface{}) *UpsertBuilder + func (b *UpsertBuilder) Whitelist(columns ...string) *UpsertBuilder