sqlquerywrapper

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sql.DB
	// contains filtered or unexported fields
}

func New

func New(db *sql.DB, opts ...Opt) *DB

func (*DB) Begin

func (db *DB) Begin() (*Tx, error)

func (*DB) BeginTx

func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

func (*DB) Exec

func (db *DB) Exec(query string, args ...interface{}) (sql.Result, error)

func (*DB) ExecContext

func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*DB) Query

func (db *DB) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*DB) QueryContext

func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func (*DB) QueryRow

func (db *DB) QueryRow(query string, args ...interface{}) *sql.Row

func (*DB) QueryRowContext

func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

func (*DB) WithTx

func (db *DB) WithTx(ctx context.Context, fn func(*Tx) error) error

type Opt

type Opt func(*DB)

func WithKeyAndValues

func WithKeyAndValues(keyAndValues ...any) Opt

func WithLogger

func WithLogger(logger logger) Opt

func WithSecretsRegex

func WithSecretsRegex(secretsRegex map[string]string) Opt

func WithSlowQueryThreshold

func WithSlowQueryThreshold(slowQueryThreshold time.Duration) Opt

type Tx

type Tx struct {
	*sql.Tx
	// contains filtered or unexported fields
}

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Exec

func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error)

func (*Tx) ExecContext

func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*Tx) Query

func (tx *Tx) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*Tx) QueryContext

func (tx *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func (*Tx) QueryRow

func (tx *Tx) QueryRow(query string, args ...interface{}) *sql.Row

func (*Tx) QueryRowContext

func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL