mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -06:00
Clarify that if the txn is nil the stmt will run outside a transaction
This commit is contained in:
parent
b0798fb79e
commit
b8e531bbcd
|
|
@ -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.
|
// 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.
|
// Otherwise returns a copy of the statement that will run inside the transaction.
|
||||||
func TxStmt(transaction *sql.Tx, statement *sql.Stmt) *sql.Stmt {
|
func TxStmt(transaction *sql.Tx, statement *sql.Stmt) *sql.Stmt {
|
||||||
if transaction != nil {
|
if transaction != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue