Documentation
¶
Index ¶
- Variables
- type Conn
- type DB
- type PostgresConn
- func (c *PostgresConn) Begin(ctx context.Context) (Tx, error)
- func (c *PostgresConn) Close() error
- func (c *PostgresConn) Exec(ctx context.Context, sql string, args ...interface{}) (int64, string, error)
- func (c *PostgresConn) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- type PostgresDB
- type PostgresTx
- func (tx *PostgresTx) Commit(ctx context.Context) error
- func (tx *PostgresTx) Exec(ctx context.Context, sql string, args ...interface{}) (int64, string, error)
- func (tx *PostgresTx) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (tx *PostgresTx) Rollback(ctx context.Context) error
- type Tx
Constants ¶
This section is empty.
Variables ¶
View Source
var TestConninfo string
TestConninfo defines connection string to the test database. It is populated at test time by internal/dbtest.RunMain (from each package's TestMain) and points to a throwaway PostgreSQL container.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type DB ¶
type DB interface {
Begin(ctx context.Context) (Tx, error)
Exec(ctx context.Context, sql string, arguments ...interface{}) (int64, string, error)
Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
Close()
}
func NewPostgresDB ¶
NewPostgresDB creates new database connections pool.
type PostgresConn ¶
type PostgresConn struct {
// contains filtered or unexported fields
}
PostgresConn wraps *pgx.Conn.
func (*PostgresConn) Begin ¶
func (c *PostgresConn) Begin(ctx context.Context) (Tx, error)
Begin opens transaction in database and returns transaction object.
func (*PostgresConn) Close ¶
func (c *PostgresConn) Close() error
type PostgresDB ¶
type PostgresDB struct {
// contains filtered or unexported fields
}
PostgresDB implements pgxpool.Pool as DB interface.
func (*PostgresDB) Begin ¶
func (db *PostgresDB) Begin(ctx context.Context) (Tx, error)
Begin opens transaction in database and returns transaction object.
type PostgresTx ¶
type PostgresTx struct {
// contains filtered or unexported fields
}
PostgresTx implements PostgreSQL transaction object.
func (*PostgresTx) Commit ¶
func (tx *PostgresTx) Commit(ctx context.Context) error
Commit does transaction commit.
func (*PostgresTx) Exec ¶
func (tx *PostgresTx) Exec(ctx context.Context, sql string, args ...interface{}) (int64, string, error)
Exec executes query expression inside the transaction and returns resulting tag.
Click to show internal directories.
Click to hide internal directories.