mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-03 06:32:47 +00:00
Consistent *sql.Tx
usage across sync API (#2744)
This tidies up the `storage` package so that everything takes a transaction parameter instead of something things that do and some that don't.
This commit is contained in:
parent
a574ed5369
commit
3f9e38e80a
20 changed files with 99 additions and 77 deletions
|
@ -91,7 +91,12 @@ func (r *notificationDataStatements) SelectUserUnreadCountsForRooms(
|
|||
params[i+1] = roomIDs[i]
|
||||
}
|
||||
sql := strings.Replace(selectUserUnreadNotificationsForRooms, "($2)", sqlutil.QueryVariadicOffset(len(roomIDs), 1), 1)
|
||||
rows, err := r.db.QueryContext(ctx, sql, params...)
|
||||
prep, err := r.db.PrepareContext(ctx, sql)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer internal.CloseAndLogIfError(ctx, prep, "SelectUserUnreadCountsForRooms: prep.close() failed")
|
||||
rows, err := sqlutil.TxStmt(txn, prep).QueryContext(ctx, params...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue