Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
*drel.Engine
Accounts *models.AccountRepository
}
func (*DB) Tx ¶ added in v0.6.0
Tx returns the tracked repositories bound to the transaction in ctx. It panics if no transaction is present, so wrap the call in WithTx.
func (*DB) WithTx ¶ added in v0.6.0
func (db *DB) WithTx(ctx context.Context, fn func(ctx context.Context) error, opts ...drel.TxOption) error
WithTx runs fn inside a transaction and puts that transaction in the context it passes to fn. Reach the tracked repositories with db.Tx(ctx). A nested call opens a savepoint on the same transaction.
type TxRepos ¶ added in v0.6.0
type TxRepos struct {
Accounts *models.TxAccountRepository
}
TxRepos holds the tracked repositories of one transaction. Load through the fields, stage with Add and Remove, then let WithTx commit.
Click to show internal directories.
Click to hide internal directories.