Documentation ¶
Index ¶
- func DeleteByColumn(ctx context.Context, tbl sqlapi.Table, req require.Requirement, column string, ...) (int64, error)
- func Exec(ctx context.Context, tbl sqlapi.Table, req require.Requirement, query string, ...) (int64, error)
- func Float32AsInterfaceSlice(values []float32) []interface{}
- func Float64AsInterfaceSlice(values []float64) []interface{}
- func GetIntIntIndex(ctx context.Context, tbl sqlapi.Table, q quote.Quoter, ...) (map[int64]int64, error)
- func GetIntStringIndex(ctx context.Context, tbl sqlapi.Table, q quote.Quoter, ...) (map[int64]string, error)
- func GetStringIntIndex(ctx context.Context, tbl sqlapi.Table, q quote.Quoter, ...) (map[string]int64, error)
- func Int16AsInterfaceSlice(values []int16) []interface{}
- func Int32AsInterfaceSlice(values []int32) []interface{}
- func Int64AsInterfaceSlice(values []int64) []interface{}
- func Int8AsInterfaceSlice(values []int8) []interface{}
- func IntAsInterfaceSlice(values []int) []interface{}
- func Query(ctx context.Context, tbl sqlapi.Table, query string, args ...interface{}) (sqlapi.SqlRows, error)
- func QueryOneNullThing(ctx context.Context, tbl sqlapi.Table, req require.Requirement, ...) error
- func ReplaceTableName(tbl sqlapi.Table, query string) string
- func SliceFloat32List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]float32, error)
- func SliceFloat32PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]float32, error)
- func SliceFloat64List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]float64, error)
- func SliceFloat64PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]float64, error)
- func SliceInt16List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int16, error)
- func SliceInt16PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int16, error)
- func SliceInt32List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int32, error)
- func SliceInt32PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int32, error)
- func SliceInt64List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int64, error)
- func SliceInt64PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int64, error)
- func SliceInt8List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int8, error)
- func SliceInt8PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int8, error)
- func SliceIntList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int, error)
- func SliceIntPtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]int, error)
- func SliceStringList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]string, error)
- func SliceStringPtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]string, error)
- func SliceUint16List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint16, error)
- func SliceUint16PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint16, error)
- func SliceUint32List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint32, error)
- func SliceUint32PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint32, error)
- func SliceUint64List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint64, error)
- func SliceUint64PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint64, error)
- func SliceUint8List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint8, error)
- func SliceUint8PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint8, error)
- func SliceUintList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint, error)
- func SliceUintPtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, ...) ([]uint, error)
- func StringAsInterfaceSlice(values []string) []interface{}
- func Uint16AsInterfaceSlice(values []uint16) []interface{}
- func Uint32AsInterfaceSlice(values []uint32) []interface{}
- func Uint64AsInterfaceSlice(values []uint64) []interface{}
- func Uint8AsInterfaceSlice(values []uint8) []interface{}
- func UintAsInterfaceSlice(values []uint) []interface{}
- func UpdateFields(ctx context.Context, tbl sqlapi.Table, req require.Requirement, ...) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteByColumn ¶ added in v0.39.0
func DeleteByColumn(ctx context.Context, tbl sqlapi.Table, req require.Requirement, column string, v ...interface{}) (int64, error)
DeleteByColumn deletes rows from the table, given some values and the name of the column they belong to. The list of values can be arbitrarily long.
If the context ctx is nil, it defaults to context.Background().
func Exec ¶
func Exec(ctx context.Context, tbl sqlapi.Table, req require.Requirement, query string, args ...interface{}) (int64, error)
Exec executes a modification query (insert, update, delete, etc) and returns the number of items affected.
The query is logged using whatever logger is configured. If an error arises, this too is logged.
If the context ctx is nil, it defaults to context.Background().
func Float32AsInterfaceSlice ¶ added in v0.41.0
func Float32AsInterfaceSlice(values []float32) []interface{}
Float32AsInterfaceSlice adapts a slice of float32 to []interface{}.
func Float64AsInterfaceSlice ¶ added in v0.41.0
func Float64AsInterfaceSlice(values []float64) []interface{}
Float64AsInterfaceSlice adapts a slice of float64 to []interface{}.
func GetIntIntIndex ¶ added in v0.31.0
func GetIntIntIndex(ctx context.Context, tbl sqlapi.Table, q quote.Quoter, keyColumn, valColumn string, wh where.Expression) (map[int64]int64, error)
GetIntIntIndex reads two integer columns from a specified database table and returns an index built from them.
If the context ctx is nil, it defaults to context.Background().
func GetIntStringIndex ¶ added in v0.31.0
func GetIntStringIndex(ctx context.Context, tbl sqlapi.Table, q quote.Quoter, keyColumn, valColumn string, wh where.Expression) (map[int64]string, error)
GetIntStringIndex reads an integer column and a string column from a specified database table and returns an index built from them.
If the context ctx is nil, it defaults to context.Background().
func GetStringIntIndex ¶ added in v0.31.0
func GetStringIntIndex(ctx context.Context, tbl sqlapi.Table, q quote.Quoter, keyColumn, valColumn string, wh where.Expression) (map[string]int64, error)
GetStringIntIndex reads a string column and an integer column from a specified database table and returns an index built from them.
If the context ctx is nil, it defaults to context.Background().
func Int16AsInterfaceSlice ¶ added in v0.41.0
func Int16AsInterfaceSlice(values []int16) []interface{}
Int16AsInterfaceSlice adapts a slice of int16 to []interface{}.
func Int32AsInterfaceSlice ¶ added in v0.41.0
func Int32AsInterfaceSlice(values []int32) []interface{}
Int32AsInterfaceSlice adapts a slice of int32 to []interface{}.
func Int64AsInterfaceSlice ¶ added in v0.41.0
func Int64AsInterfaceSlice(values []int64) []interface{}
Int64AsInterfaceSlice adapts a slice of int64 to []interface{}.
func Int8AsInterfaceSlice ¶ added in v0.41.0
func Int8AsInterfaceSlice(values []int8) []interface{}
Int8AsInterfaceSlice adapts a slice of int8 to []interface{}.
func IntAsInterfaceSlice ¶ added in v0.41.0
func IntAsInterfaceSlice(values []int) []interface{}
IntAsInterfaceSlice adapts a slice of int to []interface{}.
func Query ¶
func Query(ctx context.Context, tbl sqlapi.Table, query string, args ...interface{}) (sqlapi.SqlRows, error)
Query is the low-level request method for this table.
The query is logged using whatever logger is configured. If an error arises, this too is logged.
The args are for any placeholder parameters in the query.
The caller must call rows.Close() on the result.
If the context ctx is nil, it defaults to context.Background().
func QueryOneNullThing ¶
func QueryOneNullThing(ctx context.Context, tbl sqlapi.Table, req require.Requirement, holder interface{}, query string, args ...interface{}) error
QueryOneNullThing queries for one cell of one record. Normally, the holder will be sql.NullString or similar. If required, the query can use "{TABLE}" in place of the table name.
If the context ctx is nil, it defaults to context.Background().
func ReplaceTableName ¶
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func SliceFloat32List ¶
func SliceFloat32List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
SliceFloat32List requests a columnar slice of float32s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceFloat32PtrList ¶ added in v0.17.0
func SliceFloat32PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
SliceFloat32PtrList requests a columnar slice of float32s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceFloat64List ¶
func SliceFloat64List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
SliceFloat64List requests a columnar slice of float64s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceFloat64PtrList ¶ added in v0.17.0
func SliceFloat64PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
SliceFloat64PtrList requests a columnar slice of float64s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceInt16List ¶
func SliceInt16List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
SliceInt16List requests a columnar slice of int16s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceInt16PtrList ¶ added in v0.17.0
func SliceInt16PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
SliceInt16PtrList requests a columnar slice of int16s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceInt32List ¶
func SliceInt32List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
SliceInt32List requests a columnar slice of int32s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceInt32PtrList ¶ added in v0.17.0
func SliceInt32PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
SliceInt32PtrList requests a columnar slice of int32s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceInt64List ¶
func SliceInt64List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceInt64List requests a columnar slice of int64s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceInt64PtrList ¶ added in v0.17.0
func SliceInt64PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceInt64PtrList requests a columnar slice of int64s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceInt8List ¶
func SliceInt8List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
SliceInt8List requests a columnar slice of int8s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceInt8PtrList ¶ added in v0.17.0
func SliceInt8PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
SliceInt8PtrList requests a columnar slice of int8s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceIntList ¶
func SliceIntList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int, error)
SliceIntList requests a columnar slice of ints from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceIntPtrList ¶ added in v0.17.0
func SliceIntPtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]int, error)
SliceIntPtrList requests a columnar slice of ints from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceStringList ¶
func SliceStringList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceStringList requests a columnar slice of strings from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceStringPtrList ¶ added in v0.17.0
func SliceStringPtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceStringPtrList requests a columnar slice of strings from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceUint16List ¶
func SliceUint16List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
SliceUint16List requests a columnar slice of uint16s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceUint16PtrList ¶ added in v0.17.0
func SliceUint16PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
SliceUint16PtrList requests a columnar slice of uint16s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceUint32List ¶
func SliceUint32List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
SliceUint32List requests a columnar slice of uint32s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceUint32PtrList ¶ added in v0.17.0
func SliceUint32PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
SliceUint32PtrList requests a columnar slice of uint32s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceUint64List ¶
func SliceUint64List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
SliceUint64List requests a columnar slice of uint64s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceUint64PtrList ¶ added in v0.17.0
func SliceUint64PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
SliceUint64PtrList requests a columnar slice of uint64s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceUint8List ¶
func SliceUint8List(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
SliceUint8List requests a columnar slice of uint8s from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceUint8PtrList ¶ added in v0.17.0
func SliceUint8PtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
SliceUint8PtrList requests a columnar slice of uint8s from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func SliceUintList ¶
func SliceUintList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint, error)
SliceUintList requests a columnar slice of uints from a specified column.
If the context ctx is nil, it defaults to context.Background().
func SliceUintPtrList ¶ added in v0.17.0
func SliceUintPtrList(ctx context.Context, tbl sqlapi.Table, req require.Requirement, sqlname string, wh where.Expression, qc where.QueryConstraint) ([]uint, error)
SliceUintPtrList requests a columnar slice of uints from a specified nullable column.
If the context ctx is nil, it defaults to context.Background().
func StringAsInterfaceSlice ¶ added in v0.41.0
func StringAsInterfaceSlice(values []string) []interface{}
StringAsInterfaceSlice adapts a slice of string to []interface{}.
func Uint16AsInterfaceSlice ¶ added in v0.41.0
func Uint16AsInterfaceSlice(values []uint16) []interface{}
Uint16AsInterfaceSlice adapts a slice of uint16 to []interface{}.
func Uint32AsInterfaceSlice ¶ added in v0.41.0
func Uint32AsInterfaceSlice(values []uint32) []interface{}
Uint32AsInterfaceSlice adapts a slice of uint32 to []interface{}.
func Uint64AsInterfaceSlice ¶ added in v0.41.0
func Uint64AsInterfaceSlice(values []uint64) []interface{}
Uint64AsInterfaceSlice adapts a slice of uint64 to []interface{}.
func Uint8AsInterfaceSlice ¶ added in v0.41.0
func Uint8AsInterfaceSlice(values []uint8) []interface{}
Uint8AsInterfaceSlice adapts a slice of uint8 to []interface{}.
func UintAsInterfaceSlice ¶ added in v0.41.0
func UintAsInterfaceSlice(values []uint) []interface{}
UintAsInterfaceSlice adapts a slice of uint to []interface{}.
func UpdateFields ¶
func UpdateFields(ctx context.Context, tbl sqlapi.Table, req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
UpdateFields writes certain fields of all the records matching a 'where' expression.
If the context ctx is nil, it defaults to context.Background().
Types ¶
This section is empty.