diff options
author | Kegsay <kegan@matrix.org> | 2020-05-15 09:41:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 09:41:12 +0100 |
commit | 2b5052eccfca49e736b39a9879ebde2ab196f6da (patch) | |
tree | ebd43e4ea84cf403a0c1530833a2751faa2d255d /syncapi/storage/sqlite3/account_data_table.go | |
parent | 419ff150d41a3d0de25f0e8e66baf36948bcfbc1 (diff) |
Add Range (#1037)
* Add Range
* Use Range
Diffstat (limited to 'syncapi/storage/sqlite3/account_data_table.go')
-rw-r--r-- | syncapi/storage/sqlite3/account_data_table.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/syncapi/storage/sqlite3/account_data_table.go b/syncapi/storage/sqlite3/account_data_table.go index e5f2417b..435a399c 100644 --- a/syncapi/storage/sqlite3/account_data_table.go +++ b/syncapi/storage/sqlite3/account_data_table.go @@ -91,19 +91,12 @@ func (s *accountDataStatements) InsertAccountData( func (s *accountDataStatements) SelectAccountDataInRange( ctx context.Context, userID string, - oldPos, newPos types.StreamPosition, + r types.Range, accountDataFilterPart *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()) if err != nil { return } |