Documentation ¶
Index ¶
- type DB
- func (db *DB) Begin() (*Tx, error)
- func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (db *DB) Exec(query string, args ...interface{}) (sql.Result, error)
- func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (db *DB) Query(query string, args ...interface{}) (*Rows, error)
- func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)
- func (db *DB) QueryRow(query string, args ...interface{}) *Row
- func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *Row
- func (db *DB) WithTx(ctx context.Context, fn func(*Tx) error) error
- type Opt
- func WithKeyAndValues(keyAndValues ...any) Opt
- func WithLogger(logger logger) Opt
- func WithQueryTimeout(timeout time.Duration) Opt
- func WithSecretsRegex(secretsRegex map[string]string) Opt
- func WithSlowQueryThreshold(slowQueryThreshold time.Duration) Opt
- func WithTransactionTimeout(timeout time.Duration) Opt
- type Row
- type Rows
- type Tx
- func (tx *Tx) Commit() error
- func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error)
- func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (tx *Tx) GetTx() *sql.Tx
- func (tx *Tx) Query(query string, args ...interface{}) (*Rows, error)
- func (tx *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)
- func (tx *Tx) QueryRow(query string, args ...interface{}) *Row
- func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *Row
- func (tx *Tx) Rollback() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
func (*DB) Begin ¶
Begin starts a transaction.
Use BeginTx to pass context and options to the underlying driver.
func (*DB) ExecContext ¶
func (*DB) QueryContext ¶
func (*DB) QueryRowContext ¶
type Opt ¶
type Opt func(*DB)
func WithKeyAndValues ¶
func WithLogger ¶
func WithLogger(logger logger) Opt
func WithQueryTimeout ¶ added in v1.10.0
WithQueryTimeout imposes a timeout on each query
func WithSecretsRegex ¶
func WithSlowQueryThreshold ¶
func WithTransactionTimeout ¶ added in v1.10.0
WithTransactionTimeout imposes a timeout on the transaction
type Row ¶ added in v1.10.0
type Row struct { *sql.Row context.CancelFunc // contains filtered or unexported fields }
type Rows ¶ added in v1.10.0
type Rows struct { *sql.Rows context.CancelFunc // contains filtered or unexported fields }
type Tx ¶
type Tx struct { *sql.Tx context.CancelFunc // contains filtered or unexported fields }
func (*Tx) ExecContext ¶
func (*Tx) QueryContext ¶
func (*Tx) QueryRowContext ¶
Click to show internal directories.
Click to hide internal directories.