MCPcopy Create free account
hub / github.com/daodst/chat / EndTransactionWithCheck

Function EndTransactionWithCheck

internal/sqlutil/sql.go:53–57  ·  view source on GitHub ↗

EndTransactionWithCheck ends a transaction and overwrites the error pointer if its value was nil. If the transaction succeeded then it is committed, otherwise it is rolledback. Designed to be used with defer (see EndTransaction otherwise).

(txn Transaction, succeeded *bool, err *error)

Source from the content-addressed store, hash-verified

51// If the transaction succeeded then it is committed, otherwise it is rolledback.
52// Designed to be used with defer (see EndTransaction otherwise).
53func EndTransactionWithCheck(txn Transaction, succeeded *bool, err *error) {
54 if e := EndTransaction(txn, succeeded); e != nil && *err == nil {
55 *err = e
56 }
57}
58
59// WithTransaction runs a block of code passing in an SQL transaction
60// If the code returns an error or panics then the transactions is rolledback

Callers 1

WithTransactionFunction · 0.85

Calls 1

EndTransactionFunction · 0.85

Tested by

no test coverage detected