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

Struct txDriver

entc/integration/migrate/versioned/tx.go:169–178  ·  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

167//
168// Note that txDriver is not goroutine safe.
169type txDriver struct {
170 // the driver we started the transaction from.
171 drv dialect.Driver
172 // tx is the underlying transaction.
173 tx dialect.Tx
174 // completion hooks.
175 mu sync.Mutex
176 onCommit []CommitHook
177 onRollback []RollbackHook
178}
179
180// newTx creates a new transactional driver.
181func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected