EndTransaction ends a transaction. If the transaction succeeded then it is committed, otherwise it is rolledback. You MUST check the error returned from this function to be sure that the transaction was applied correctly. For example, 'database is locked' errors in sqlite will happen here.
(txn Transaction, succeeded *bool)
| 40 | // You MUST check the error returned from this function to be sure that the transaction |
| 41 | // was applied correctly. For example, 'database is locked' errors in sqlite will happen here. |
| 42 | func EndTransaction(txn Transaction, succeeded *bool) error { |
| 43 | if *succeeded { |
| 44 | return txn.Commit() |
| 45 | } else { |
| 46 | return txn.Rollback() |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | // EndTransactionWithCheck ends a transaction and overwrites the error pointer if its value was nil. |
| 51 | // If the transaction succeeded then it is committed, otherwise it is rolledback. |
no test coverage detected