Documentation
¶
Index ¶
- func ByID[T any, ID string | int](m DB, id ID) (*T, error)
- func BySQL[T any](m DB, query string, args ...interface{}) (*T, error)
- func CountQuery(m DB, table string, query string, args ...interface{}) (int, error)
- func DeleteByID[ID string | int](m DB, table string, id ID) error
- func DeleteBySQL(m DB, table string, query string, args ...interface{}) error
- func Exists[ID string | int](m DB, table string, id ID) (bool, error)
- func ExistsBySQL(m DB, table string, query string, args ...interface{}) (bool, error)
- func ForceRunInTx(m DB, fn func(tx TxContext) error) error
- func Insert[T any](m DB, row *T) error
- func InsertMany[T any](m DB, rows []T) error
- func Many[T any](m DB, query string, args ...interface{}) ([]T, error)
- func RunInLockedTx(m DB, id string, fn func(tx TxContext) error) error
- func RunInTx(m DB, fn func(tx TxContext) error) error
- func StructByID[T any, ID string | int](m DB, table string, id ID) (*T, error)
- func StructBySQL[T any](m DB, table string, query string, args ...interface{}) (*T, error)
- func TypeByID[T any, ID string | int](m DB, table string, column string, id ID) (*T, error)
- func TypeBySQL[T any](m DB, table string, column string, query string, args ...interface{}) (*T, error)
- func Update[T any](m DB, row *T, pk ...string) error
- func UpdateSQLByID[ID string | int](m DB, table string, id ID, query string, args ...interface{}) error
- func Upsert[T any](m DB, rows T, conflictColumns string) error
- func UpsertIgnore[T any](m DB, rows T) error
- type Context
- func (m Context) Context() context.Context
- func (m Context) ForceRunInTx(fn func(tx TxContext) error) error
- func (m Context) NewDelete() *bun.DeleteQuery
- func (m Context) NewInsert() *bun.InsertQuery
- func (m Context) NewMerge() *bun.MergeQuery
- func (m Context) NewRaw(query string, args ...interface{}) *bun.RawQuery
- func (m Context) NewSelect() *bun.SelectQuery
- func (m Context) NewUpdate() *bun.UpdateQuery
- func (m Context) NewValues(model interface{}) *bun.ValuesQuery
- func (m Context) RunInTx(fn func(tx TxContext) error) error
- type DB
- type TxContext
- func (m TxContext) Context() context.Context
- func (m TxContext) ForceRunInTx(fn func(tx TxContext) error) error
- func (m TxContext) NewDelete() *bun.DeleteQuery
- func (m TxContext) NewInsert() *bun.InsertQuery
- func (m TxContext) NewMerge() *bun.MergeQuery
- func (m TxContext) NewRaw(query string, args ...interface{}) *bun.RawQuery
- func (m TxContext) NewSelect() *bun.SelectQuery
- func (m TxContext) NewUpdate() *bun.UpdateQuery
- func (m TxContext) NewValues(model interface{}) *bun.ValuesQuery
- func (m TxContext) RunInTx(fn func(tx TxContext) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountQuery ¶
func ExistsBySQL ¶
func InsertMany ¶
func StructBySQL ¶
func UpdateSQLByID ¶
func Upsert ¶
To upsert and check multiple constraints, see https://stackoverflow.com/questions/35888012/use-multiple-conflict-target-in-on-conflict-clause
func UpsertIgnore ¶
Types ¶
type Context ¶
func (Context) NewDelete ¶
func (m Context) NewDelete() *bun.DeleteQuery
func (Context) NewInsert ¶
func (m Context) NewInsert() *bun.InsertQuery
func (Context) NewMerge ¶
func (m Context) NewMerge() *bun.MergeQuery
func (Context) NewSelect ¶
func (m Context) NewSelect() *bun.SelectQuery
func (Context) NewUpdate ¶
func (m Context) NewUpdate() *bun.UpdateQuery
func (Context) NewValues ¶
func (m Context) NewValues(model interface{}) *bun.ValuesQuery
type DB ¶
type DB interface { Context() context.Context NewSelect() *bun.SelectQuery NewInsert() *bun.InsertQuery NewUpdate() *bun.UpdateQuery NewDelete() *bun.DeleteQuery NewMerge() *bun.MergeQuery NewRaw(string, ...interface{}) *bun.RawQuery NewValues(model interface{}) *bun.ValuesQuery RunInTx(fn func(tx TxContext) error) error ForceRunInTx(fn func(tx TxContext) error) error }
type TxContext ¶
func (TxContext) NewDelete ¶
func (m TxContext) NewDelete() *bun.DeleteQuery
func (TxContext) NewInsert ¶
func (m TxContext) NewInsert() *bun.InsertQuery
func (TxContext) NewMerge ¶
func (m TxContext) NewMerge() *bun.MergeQuery
func (TxContext) NewSelect ¶
func (m TxContext) NewSelect() *bun.SelectQuery
func (TxContext) NewUpdate ¶
func (m TxContext) NewUpdate() *bun.UpdateQuery
func (TxContext) NewValues ¶
func (m TxContext) NewValues(model interface{}) *bun.ValuesQuery
Click to show internal directories.
Click to hide internal directories.