Documentation ¶
Overview ¶
Package transaction contains interfaces and business logic for managing transactions
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Transactional ¶
func Transactional(tm TransactionManager, todo func(f TransactionalResources) error) error
Transactional executes the given function in a transaction. If todo returns an error, the transaction is rolled back
Types ¶
type Transaction ¶
type Transaction interface { TransactionalResources Commit() error Rollback() error }
Transaction represents an existing transaction. It provides access to transactional resources, plus methods to commit or roll back the transaction
type TransactionManager ¶
type TransactionManager interface {
BeginTransaction() (Transaction, error)
}
TransactionManager manages the lifecycle of a database transaction. The transactional resources (such as repositories) created for the transaction object make changes inside the transaction
type TransactionalResources ¶
type TransactionalResources interface { repository.Repositories }
TransactionalResources provides a reference to transactional resources available during a transaction
Click to show internal directories.
Click to hide internal directories.