dbdriver

package
v0.0.0-...-cb66316 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, connString string) (*pgxpool.Pool, error)

Connect connString like: // # Example DSN

user=jack password=secret host=pg.example.com port=5432 dbname=mydb sslmode=verify-ca pool_max_conns=10

# Example URL
postgres://jack:secret@pg.example.com:5432/mydb?sslmode=verify-ca&pool_max_conns=10

Types

type Config

type Config struct {
	Logger     zerolog.Logger
	ConnString string
}

type DB

type DB struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, cfg Config) (*DB, error)

func (*DB) Begin

func (o *DB) Begin(ctx context.Context) (pgx.Tx, error)

func (*DB) Close

func (o *DB) Close()

func (*DB) RawConn

func (o *DB) RawConn() *pgxpool.Pool

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type RowScanner

type RowScanner interface {
	Scan(dest ...interface{}) error
}

Jump to

Keyboard shortcuts

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