pgx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

func NewConn

func NewConn(conn *pgx.Conn) *Conn

func (*Conn) Close

func (c *Conn) Close()

func (*Conn) Get

func (c *Conn) Get() *pgx.Conn

func (*Conn) Ping

func (c *Conn) Ping(ctx context.Context) error

func (*Conn) Scope

func (c *Conn) Scope(ctx context.Context) Scope

type Connection

type Connection interface {
	// Scope returns connection scope or transactional scope from context.
	Scope(ctx context.Context) Scope
	// Ping checks connection to a database.
	Ping(ctx context.Context) error
	// Close closes underlying connection.
	Close()
}

type Pool

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

func NewPool

func NewPool(pool *pgxpool.Pool) *Pool

func (*Pool) Close

func (p *Pool) Close()

func (*Pool) Ping

func (p *Pool) Ping(ctx context.Context) error

func (*Pool) Scope

func (p *Pool) Scope(ctx context.Context) Scope

type Scope

type Scope interface {
	Begin(ctx context.Context) (pgx.Tx, error)
	Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, optionsAndArgs ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, optionsAndArgs ...interface{}) pgx.Row
}

type Transaction

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

func (*Transaction) Commit

func (tx *Transaction) Commit() error

func (*Transaction) Context

func (tx *Transaction) Context() context.Context

func (*Transaction) Rollback

func (tx *Transaction) Rollback() error

type TransactionManager

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

func NewTransactionManager

func NewTransactionManager(connection Connection) *TransactionManager

func (*TransactionManager) Begin

func (*TransactionManager) DoTransactionally

func (manager *TransactionManager) DoTransactionally(
	ctx context.Context,
	action func(ctx context.Context) error,
) error

Jump to

Keyboard shortcuts

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