Documentation
¶
Overview ¶
Package database defines the interface to the database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFactory = &factory{}
DefaultFactory creates a pool of PGX connections.
Functions ¶
This section is empty.
Types ¶
type Connection ¶ added in v0.0.1
type Connection interface {
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
QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)
SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
Begin(ctx context.Context) (pgx.Tx, error)
BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
BeginFunc(ctx context.Context, f func(pgx.Tx) error) error
BeginTxFunc(ctx context.Context, txOptions pgx.TxOptions, f func(pgx.Tx) error) error
}
Connection defines the methods to access the database.
type Factory ¶ added in v0.1.0
type Factory interface {
//New creates a new connection to the database.
New(ctx context.Context, URL string) (Connection, error)
//ReadOnly creates a read only connection to the database.
ReadOnly(ctx context.Context, URL string) (Connection, error)
}
Factory creates database connections
Click to show internal directories.
Click to hide internal directories.