Documentation ¶
Index ¶
- func ProvidePgConnectionPool() (*pgxpool.Pool, error)
- type Database
- func (db *Database) ExtractTx(ctx context.Context) pgx.Tx
- func (db *Database) ExtractTxWithError(ctx context.Context) (pgx.Tx, error)
- func (db *Database) ExtractTxWithoutError(ctx context.Context) pgx.Tx
- func (db *Database) GetExistingOrNewTransaction(ctx context.Context) (pgx.Tx, error)
- func (db *Database) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (db *Database) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
- func (db *Database) WithinTransaction(ctx context.Context, tFunc func(ctx context.Context) error) error
- type TransactionManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProvidePgConnectionPool ¶
Types ¶
type Database ¶
func (*Database) ExtractTx ¶
extractTx extracts transaction from context and creates a new tx if it doesn't exist.
func (*Database) ExtractTxWithError ¶
func (*Database) ExtractTxWithoutError ¶
func (*Database) GetExistingOrNewTransaction ¶
type TransactionManager ¶
type TransactionManager interface { // WithinTransaction runs a function within a database transaction. // // Transaction is propagated in the context, // so it is important to propagate it to underlying repositories. // Function commits if error is nil, and rollbacks if not. // It returns the same error. WithinTransaction(context.Context, func(ctx context.Context) error) error }
TransactionManager runs logic inside a single database transaction
func ProvideNewPostgresTransactor ¶
func ProvideNewPostgresTransactor(db *Database) (TransactionManager, error)
Click to show internal directories.
Click to hide internal directories.