MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / ExecuteInTx

Function ExecuteInTx

client/tx.go:41–52  ·  view source on GitHub ↗

ExecuteInTx runs fn inside tx which should already have begun.

(tx driver.Tx, fn func() error)

Source from the content-addressed store, hash-verified

39
40// ExecuteInTx runs fn inside tx which should already have begun.
41func ExecuteInTx(tx driver.Tx, fn func() error) (err error) {
42 err = fn()
43 if err == nil {
44 err = tx.Commit()
45 if err != nil {
46 err = errors.Wrapf(err, "exec in tx")
47 }
48 } else {
49 _ = tx.Rollback()
50 }
51 return
52}

Callers 1

ExecuteTxFunction · 0.85

Calls 2

CommitMethod · 0.65
RollbackMethod · 0.65

Tested by

no test coverage detected