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

Struct txDriver

entc/integration/idtype/ent/tx.go:166–175  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected