15 lines
468 B
Go
15 lines
468 B
Go
|
|
package postgres
|
||
|
|
|
||
|
|
import "context"
|
||
|
|
|
||
|
|
// Tx extends [Executor] with commit and rollback. Obtained via [Provider.Begin]
|
||
|
|
// or [Provider.BeginTx] when manual transaction control is needed.
|
||
|
|
// Prefer [UnitOfWork] for the common case of a single transactional unit.
|
||
|
|
type Tx interface {
|
||
|
|
Executor
|
||
|
|
// Commit commits the transaction.
|
||
|
|
Commit(ctx context.Context) error
|
||
|
|
// Rollback rolls back the transaction. Safe to call after Commit.
|
||
|
|
Rollback(ctx context.Context) error
|
||
|
|
}
|