Documentation ¶
Overview ¶
Package sdbun bun 扩展包
Index ¶
- Variables
- func Count[ROW any](ctx context.Context, db bun.IDB, qfn func(*bun.SelectQuery) *bun.SelectQuery) (int64, error)
- func Delete[ROW any](ctx context.Context, db bun.IDB, ...) (sdsql.Result, error)
- func Dial(addr Address, opts ...bun.DBOption) (*bun.DB, error)
- func Exists[ROW any](ctx context.Context, db bun.IDB, qfn func(*bun.SelectQuery) *bun.SelectQuery) (bool, error)
- func Insert(ctx context.Context, db bun.IDB, v any, ...) (sdsql.Result, error)
- func LoggerOf(name string) bun.QueryHook
- func PageApplier(p sdsql.Page) func(*bun.SelectQuery) *bun.SelectQuery
- func SelectFirst[ROW any](ctx context.Context, db bun.IDB, qfn func(*bun.SelectQuery) *bun.SelectQuery, ...) (ROW, error)
- func SelectFirstRaw[ROW any](ctx context.Context, db bun.IDB, q string, args []any, ...) (ROW, error)
- func SelectMany[ROW any](ctx context.Context, db bun.IDB, qfn func(*bun.SelectQuery) *bun.SelectQuery, ...) ([]ROW, error)
- func SelectManyAndCount[ROW any](ctx context.Context, db bun.IDB, qfn func(*bun.SelectQuery) *bun.SelectQuery, ...) ([]ROW, int64, error)
- func SelectManyRaw[ROW any](ctx context.Context, db bun.IDB, q string, args []any, ...) ([]ROW, error)
- func SelectMap[ROW any, K comparable, V any](ctx context.Context, db bun.IDB, qfn func(*bun.SelectQuery) *bun.SelectQuery, ...) (map[K]V, error)
- func SelectMapRaw[ROW any, K comparable, V any](ctx context.Context, db bun.IDB, q string, args []any, ...) (map[K]V, error)
- func SelectOne[T any](ctx context.Context, db bun.IDB, q string, args []any) (T, error)
- func SelectPage[ROW any](ctx context.Context, db bun.IDB, p sdsql.Page, ...) (*sdsql.PagingResult[ROW], error)
- func Tx(ctx context.Context, db bun.IDB, action func(context.Context, bun.Tx) error, ...) error
- func TxFor[R any](ctx context.Context, db bun.IDB, ...) (R, error)
- func Update(ctx context.Context, db bun.IDB, v any, ...) (sdsql.Result, error)
- type Address
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrIllegalDriver = sderr.Sentinel("illegal driver")
)
Functions ¶
func PageApplier ¶
func PageApplier(p sdsql.Page) func(*bun.SelectQuery) *bun.SelectQuery
func SelectFirst ¶
func SelectFirstRaw ¶
func SelectMany ¶
func SelectManyAndCount ¶
func SelectManyRaw ¶
func SelectMap ¶ added in v0.2.1
func SelectMap[ROW any, K comparable, V any](ctx context.Context, db bun.IDB, qfn func(*bun.SelectQuery) *bun.SelectQuery, transform func(ROW) (K, V), postProcs ...sdsql.RowsProc[ROW]) (map[K]V, error)
func SelectMapRaw ¶ added in v0.2.1
func SelectPage ¶ added in v0.2.2
Types ¶
type Address ¶
type Address struct { // common Driver string `json:"driver" toml:"driver" yaml:"driver"` DSN string `json:"dsn" toml:"dsn" yaml:"dsn"` Logger string `json:"logger" toml:"logger"` // options ConnMaxLifeTimeMS int64 `json:"conn_max_lifetime" toml:"conn_max_lifetime" yaml:"conn_max_lifetime"` ConnMaxIdleTimeMS int64 `json:"conn_max_idle_time" toml:"conn_max_idle_time" yaml:"conn_max_idle_time"` MaxIdleConns int `json:"max_idle_conns" toml:"max_idle_conns" yaml:"max_idle_conns"` MaxOpenConns int `json:"max_open_conns" toml:"max_open_conns" yaml:"max_open_conns"` }
Click to show internal directories.
Click to hide internal directories.