Skip to content

Commit 59fcdb4

Browse files
committed
remove if
1 parent f4bea14 commit 59fcdb4

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

types/query/collections_pagination.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,10 @@ func encodeCollKey[K, V any, C Collection[K, V]](coll C, key K) ([]byte, error)
330330
func getCollIter[K, V any, C Collection[K, V]](ctx context.Context, coll C, prefix, start []byte, reverse bool) (collections.Iterator[K, V], error) {
331331
// TODO: maybe can be simplified
332332
if reverse {
333-
var end []byte
334-
if prefix != nil {
335-
start = append(prefix, start...)
336-
end = prefix
337-
}
338-
339333
// if we are in reverse mode, we need to increase the start key
340334
// to include the start key in the iteration.
341-
start = storetypes.PrefixEndBytes(start)
335+
start = storetypes.PrefixEndBytes(append(prefix, start...))
336+
end := prefix
342337

343338
return coll.IterateRaw(ctx, end, start, collections.OrderDescending)
344339
}

0 commit comments

Comments
 (0)