pg

package
v0.0.0-...-9a2c5cd Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTx

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

WithTx executes a function within transaction.

Types

type Database

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

func New

func New(ctx context.Context, log *wlog.Logger, dsn string) (*Database, error)

func (*Database) Batch

func (db *Database) Batch() dbsql.Batcher

func (*Database) Close

func (db *Database) Close()

func (*Database) Exec

func (db *Database) Exec(ctx context.Context, query string, args ...any) (int64, error)

func (*Database) Query

func (db *Database) Query(ctx context.Context, query string, args ...any) (scanner.Rows, error)

func (*Database) Stdlib

func (db *Database) Stdlib() *sql.DB

type RowsAdapter

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

RowsAdapter makes pgx.Rows compliant with the scanner.Rows interface. See dbsql.Rows for details.

func NewRowsAdapter

func NewRowsAdapter(rows pgx.Rows) *RowsAdapter

NewRowsAdapter returns a new rowsAdapter instance.

func (RowsAdapter) Close

func (ra RowsAdapter) Close() error

Close implements the dbscan.Rows.Close method.

func (RowsAdapter) Columns

func (ra RowsAdapter) Columns() ([]string, error)

Columns implements the dbscan.Rows.Columns method.

func (RowsAdapter) Err

func (ra RowsAdapter) Err() error

func (RowsAdapter) Next

func (ra RowsAdapter) Next() bool

func (RowsAdapter) NextResultSet

func (ra RowsAdapter) NextResultSet() bool

NextResultSet is currently always returning false.

func (RowsAdapter) Scan

func (ra RowsAdapter) Scan(dest ...any) error

func (RowsAdapter) Types

func (ra RowsAdapter) Types() ([]string, error)

func (RowsAdapter) Values

func (ra RowsAdapter) Values() ([]any, error)

type WithTxFunc

type WithTxFunc func(ctx context.Context, tx pgx.Tx) error

WithTxFunc represents a function that will be executed within transaction.

Jump to

Keyboard shortcuts

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