func()

in transaction/transaction.go [218:244]


func (txs *Transactions) Commit() (err error) {
	errors := new(wrappedErrors)
	defer func() {
		err = errors.inner
	}()
	if txs.autoClose {
		defer func() {
			errors.add(txs.Close())
		}()
	}
	if txs.autoRollback {
		defer func() {
			if errors.inner != nil {
				cause := errors.inner
				errors.add(txs.Rollback(cause))
			}
		}()
	}
	for _, tx := range txs.txQueue {
		txs.rollbackStack = append(txs.rollbackStack, tx)
		if e := tx.Commit(); e != nil {
			errors.add(e)
			break
		}
	}
	return err
}