MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / txDriver

Struct txDriver

app/controlplane/pkg/data/ent/tx.go:219–228  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected