aboutsummaryrefslogtreecommitdiff
path: root/syncapi/storage/postgres/account_data_table.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-05-15 09:41:12 +0100
committerGitHub <noreply@github.com>2020-05-15 09:41:12 +0100
commit2b5052eccfca49e736b39a9879ebde2ab196f6da (patch)
treeebd43e4ea84cf403a0c1530833a2751faa2d255d /syncapi/storage/postgres/account_data_table.go
parent419ff150d41a3d0de25f0e8e66baf36948bcfbc1 (diff)
Add Range (#1037)
* Add Range * Use Range
Diffstat (limited to 'syncapi/storage/postgres/account_data_table.go')
-rw-r--r--syncapi/storage/postgres/account_data_table.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/syncapi/storage/postgres/account_data_table.go b/syncapi/storage/postgres/account_data_table.go
index 58fb2198..a5e0c121 100644
--- a/syncapi/storage/postgres/account_data_table.go
+++ b/syncapi/storage/postgres/account_data_table.go
@@ -100,19 +100,12 @@ func (s *accountDataStatements) InsertAccountData(
func (s *accountDataStatements) SelectAccountDataInRange(
ctx context.Context,
userID string,
- oldPos, newPos types.StreamPosition,
+ r types.Range,
accountDataEventFilter *gomatrixserverlib.EventFilter,
) (data map[string][]string, err error) {
data = make(map[string][]string)
- // If both positions are the same, it means that the data was saved after the
- // latest room event. In that case, we need to decrement the old position as
- // it would prevent the SQL request from returning anything.
- if oldPos == newPos {
- oldPos--
- }
-
- rows, err := s.selectAccountDataInRangeStmt.QueryContext(ctx, userID, oldPos, newPos,
+ rows, err := s.selectAccountDataInRangeStmt.QueryContext(ctx, userID, r.Low(), r.High(),
pq.StringArray(filterConvertTypeWildcardToSQL(accountDataEventFilter.Types)),
pq.StringArray(filterConvertTypeWildcardToSQL(accountDataEventFilter.NotTypes)),
accountDataEventFilter.Limit,