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

Struct txDriver

entc/integration/ent/tx.go:222–231  ·  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

220//
221// Note that txDriver is not goroutine safe.
222type txDriver struct {
223 // the driver we started the transaction from.
224 drv dialect.Driver
225 // tx is the underlying transaction.
226 tx dialect.Tx
227 // completion hooks.
228 mu sync.Mutex
229 onCommit []CommitHook
230 onRollback []RollbackHook
231}
232
233// newTx creates a new transactional driver.
234func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected