Handle nil in transaction

This commit is contained in:
Kegan Dougal 2020-05-27 17:53:10 +01:00
parent a420a4f072
commit 7c63b5cbb4

View file

@ -43,10 +43,18 @@ type transaction struct {
// Commit implements types.Transaction
func (t *transaction) Commit() error {
if t.txn == nil {
// The Updater structs can operate in useTxns=false mode. The code will still call this though.
return nil
}
return t.txn.Commit()
}
// Rollback implements types.Transaction
func (t *transaction) Rollback() error {
if t.txn == nil {
// The Updater structs can operate in useTxns=false mode. The code will still call this though.
return nil
}
return t.txn.Rollback()
}