dbpg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 5 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 {
	Master *sql.DB
	Slaves []*sql.DB
}

func New

func New(masterDSN string, slaveDSNs []string, opts *Options) (*DB, error)

func (*DB) BatchExec

func (db *DB) BatchExec(ctx context.Context, in <-chan string)

func (*DB) ExecContext

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

func (*DB) ExecWithRetry

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

func (*DB) QueryContext

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

func (*DB) QueryWithRetry

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

type Options

type Options struct {
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime time.Duration
}

Jump to

Keyboard shortcuts

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