Clarify that if the txn is nil the stmt will run outside a transaction

This commit is contained in:
Mark Haines 2017-08-21 17:13:30 +01:00
parent b0798fb79e
commit b8e531bbcd

View file

@ -57,7 +57,8 @@ func WithTransaction(db *sql.DB, fn func(txn *sql.Tx) error) (err error) {
}
// TxStmt wraps an SQL stmt inside an optional transaction.
// If the transaction is nil then it returns the original statement.
// If the transaction is nil then it returns the original statement that will
// run outside of a transaction.
// Otherwise returns a copy of the statement that will run inside the transaction.
func TxStmt(transaction *sql.Tx, statement *sql.Stmt) *sql.Stmt {
if transaction != nil {