pg

package
v0.0.0-...-d50500a Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 12 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 BatchResults

type BatchResults struct {
	pgx.BatchResults
}

func NewBatchResultsAdapter

func NewBatchResultsAdapter(b pgx.BatchResults) *BatchResults

func (*BatchResults) Close

func (b *BatchResults) Close() error

func (*BatchResults) Exec

func (b *BatchResults) Exec(_ context.Context, _ string, _ []any) error

func (*BatchResults) Query

func (b *BatchResults) Query(_ context.Context, _ string, _ []any) (cluster.Rows, error)

type Database

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

func NewDatabase

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

func (*Database) Close

func (db *Database) Close()

func (*Database) Exec

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

func (*Database) Query

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

func (*Database) SendBatch

func (db *Database) SendBatch(ctx context.Context, queries []*cluster.Query) cluster.BatchResults

func (*Database) Stdlib

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

type RowsAdapter

type RowsAdapter struct {
	pgx.Rows
}

RowsAdapter makes pgx.Rows compliant with the dbsql.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) NextResultSet

func (ra RowsAdapter) NextResultSet() bool

NextResultSet is currently always returning false.

func (RowsAdapter) Types

func (ra RowsAdapter) Types() ([]string, 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