diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-09-28 10:18:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-28 10:18:03 +0100 |
commit | 3f9e38e80a7be356aaf1294038888df27e0697a8 (patch) | |
tree | 529efc1f8841e409c590d698495c4a9e96383308 /syncapi/storage/postgres/account_data_table.go | |
parent | a574ed53696c06e6be6dbe313af0caaa56a659ec (diff) |
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.
Diffstat (limited to 'syncapi/storage/postgres/account_data_table.go')
-rw-r--r-- | syncapi/storage/postgres/account_data_table.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/syncapi/storage/postgres/account_data_table.go b/syncapi/storage/postgres/account_data_table.go index e9c72058..aa54cb08 100644 --- a/syncapi/storage/postgres/account_data_table.go +++ b/syncapi/storage/postgres/account_data_table.go @@ -99,14 +99,15 @@ func (s *accountDataStatements) InsertAccountData( } func (s *accountDataStatements) SelectAccountDataInRange( - ctx context.Context, + ctx context.Context, txn *sql.Tx, userID string, r types.Range, accountDataEventFilter *gomatrixserverlib.EventFilter, ) (data map[string][]string, pos types.StreamPosition, err error) { data = make(map[string][]string) - rows, err := s.selectAccountDataInRangeStmt.QueryContext(ctx, userID, r.Low(), r.High(), + rows, err := sqlutil.TxStmt(txn, s.selectAccountDataInRangeStmt).QueryContext( + ctx, userID, r.Low(), r.High(), pq.StringArray(filterConvertTypeWildcardToSQL(accountDataEventFilter.Types)), pq.StringArray(filterConvertTypeWildcardToSQL(accountDataEventFilter.NotTypes)), accountDataEventFilter.Limit, |