Documentation
¶
Index ¶
Constants ¶
View Source
const OpEqual op = "="
View Source
const OpGt op = ">"
View Source
const OpGte op = ">="
View Source
const OpIn op = "in"
View Source
const OpLt op = "<"
View Source
const OpLte op = "<="
View Source
const OpNotEqual op = "<>"
Variables ¶
View Source
var ErrNotFound error = errors.New("record not found")
Functions ¶
This section is empty.
Types ¶
type QueryJoiner ¶
type QueryJoiner string
const QueryJoinerAnd QueryJoiner = "and"
const QueryJoinerOr QueryJoiner = "or"
func (QueryJoiner) GetQueryWithArgs ¶
func (o QueryJoiner) GetQueryWithArgs() (string, []any)
type Row ¶
type Row[T any] interface { // FieldsVals returns all fields of a struct for use with row.Scan. FieldsVals() []any ScanRow(row RowScanner) error *T }
Row is a type constraint for types representing a single database row.
type RowScanner ¶
type Store ¶
type Store[T any, R Row[T]] interface { Insert(obj T) (int64, error) Update(id int64, obj T) error GetMulti(ids []int64) ([]T, error) GetOne(id int64) (T, error) // FindWhere WhereConds must be either empty or joined by QueryJoiners FindWhere(...Cond) ([]T, error) DeleteMulti(ids []int64) error Close() error }
Store is a generic interface to create, insert, update, retrieve, delete O. Note that O is a struct that might contain an array of primitive values or even structs
Click to show internal directories.
Click to hide internal directories.