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

Method Commit

app/controlplane/pkg/data/ent/tx.go:98–110  ·  view source on GitHub ↗

Commit commits the transaction.

()

Source from the content-addressed store, hash-verified

96
97// Commit commits the transaction.
98func (tx *Tx) Commit() error {
99 txDriver := tx.config.driver.(*txDriver)
100 var fn Committer = CommitFunc(func(context.Context, *Tx) error {
101 return txDriver.tx.Commit()
102 })
103 txDriver.mu.Lock()
104 hooks := append([]CommitHook(nil), txDriver.onCommit...)
105 txDriver.mu.Unlock()
106 for i := len(hooks) - 1; i >= 0; i-- {
107 fn = hooks[i](fn)
108 }
109 return fn.Commit(tx.ctx, tx)
110}
111
112// OnCommit adds a hook to call on commit.
113func (tx *Tx) OnCommit(f CommitHook) {

Callers

nothing calls this directly

Calls 2

CommitMethod · 0.95
CommitFuncFuncType · 0.85

Tested by

no test coverage detected