MCPcopy
hub / github.com/ent/ent / txDriver

Struct txDriver

entc/integration/migrate/entv2/tx.go:190–199  ·  view source on GitHub ↗

txDriver wraps the given dialect.Tx with a nop dialect.Driver implementation. The idea is to support transactions without adding any extra code to the builders. When a builder calls to driver.Tx(), it gets the same dialect.Tx instance. Commit and Rollback are nop for the internal builders and the us

Source from the content-addressed store, hash-verified

188//
189// Note that txDriver is not goroutine safe.
190type txDriver struct {
191 // the driver we started the transaction from.
192 drv dialect.Driver
193 // tx is the underlying transaction.
194 tx dialect.Tx
195 // completion hooks.
196 mu sync.Mutex
197 onCommit []CommitHook
198 onRollback []RollbackHook
199}
200
201// newTx creates a new transactional driver.
202func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected