Documentation ¶
Index ¶
- func Committed(ctx context.Context, f func(ctx context.Context))
- func Exec(ctx context.Context, query string, args ...any) (sql.Result, error)
- func GetTx(ctx context.Context) *sql.Tx
- func IsInTx(ctx context.Context) bool
- func Iter(ctx context.Context, iter pgsql.Iterator, query string, args ...any) error
- func KeyMiddleware(key any, db DB) func(h http.Handler) http.Handler
- func Middleware(db DB) func(h http.Handler) http.Handler
- func NewContext(ctx context.Context, db DB) context.Context
- func NewKeyContext(ctx context.Context, key any, db DB) context.Context
- func Prepare(ctx context.Context, query string) (*sql.Stmt, error)
- func Query(ctx context.Context, query string, args ...any) (*pgsql.Rows, error)
- func QueryRow(ctx context.Context, query string, args ...any) *pgsql.Row
- func RunInReadOnlyTx(ctx context.Context, f func(ctx context.Context) error) error
- func RunInTx(ctx context.Context, f func(ctx context.Context) error) error
- func RunInTxOptions(ctx context.Context, opt *pgsql.TxOptions, f func(ctx context.Context) error) error
- func With(ctx context.Context, key any) context.Context
- type DB
- type Queryer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyMiddleware ¶ added in v0.10.0
func Middleware ¶
Middleware injects db into request's context
func NewContext ¶
NewContext creates new context
func NewKeyContext ¶ added in v0.10.0
func RunInReadOnlyTx ¶ added in v0.13.0
RunInReadOnlyTx calls RunInTxOptions with read only options
Types ¶
type Queryer ¶
type Queryer interface { QueryRowContext(context.Context, string, ...any) *sql.Row QueryContext(context.Context, string, ...any) (*sql.Rows, error) ExecContext(context.Context, string, ...any) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) }
Queryer interface
Click to show internal directories.
Click to hide internal directories.