Documentation ¶
Overview ¶
Package database defines the interface to the database.
Package database defines the interface to the database.
Index ¶
- type Connection
- type Pool
- func (p *Pool) Begin(ctx context.Context) (pgx.Tx, error)
- func (p *Pool) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
- func (p *Pool) Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)
- func (p *Pool) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (p *Pool) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
- func (p *Pool) Refresh(ctx context.Context) error
- func (p *Pool) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶ added in v0.1.0
type Connection 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, args ...interface{}) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row }
Connection defines the methods used to access the database. It is also implemented by a mock database connection for testing.
type Pool ¶ added in v0.3.0
type Pool struct { URL string // contains filtered or unexported fields }
Pool provides a set of connections to the target database.
func New ¶
New creates a new connection to the database. It waits until a connection can be established, or that the context has been cancelled.
func ReadOnly ¶ added in v0.3.0
ReadOnly creates a new connection to the database with follower reads It waits until a connection can be established, or that the context has been cancelled.
func (*Pool) Exec ¶ added in v0.3.0
func (p *Pool) Exec( ctx context.Context, sql string, args ...interface{}, ) (pgconn.CommandTag, error)
Exec implements Connection.
Click to show internal directories.
Click to hide internal directories.