Skip to content

Commit

Permalink
rkey: scan - order by id (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
mapogolions authored Nov 11, 2024
1 parent 9a4edc6 commit 25b6f41
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/rkey/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const (
where
id > ? and key glob ? and (type = ? or true)
and (etime is null or etime > ?)
order by id asc
limit ?`
)

Expand Down Expand Up @@ -347,10 +348,8 @@ func (tx *Tx) Scan(cursor int, pattern string, ktype core.TypeID, count int) (Sc

// Select the maximum ID.
maxID := 0
for _, key := range keys {
if key.ID > maxID {
maxID = key.ID
}
if len(keys) > 0 {
maxID = keys[len(keys)-1].ID
}

return ScanResult{maxID, keys}, nil
Expand Down

0 comments on commit 25b6f41

Please sign in to comment.