diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/sqlutil/sql.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/sqlutil/sql.go b/internal/sqlutil/sql.go index 90562ded..a3885d66 100644 --- a/internal/sqlutil/sql.go +++ b/internal/sqlutil/sql.go @@ -88,6 +88,14 @@ func TxStmt(transaction *sql.Tx, statement *sql.Stmt) *sql.Stmt { return statement } +// TxStmtContext behaves similarly to TxStmt, with support for also passing context. +func TxStmtContext(context context.Context, transaction *sql.Tx, statement *sql.Stmt) *sql.Stmt { + if transaction != nil { + statement = transaction.StmtContext(context, statement) + } + return statement +} + // Hack of the century func QueryVariadic(count int) string { return QueryVariadicOffset(count, 0) |