kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
486 stars 39 forks source link

Feature request for range searches, add an offset attribute #33

Closed kylebernhardy closed 3 years ago

kylebernhardy commented 3 years ago

Hi,

I was wondering if an offset option could be added to range searches. This would allow for pagination in conjunction with the limit attribute. An example would be getting the first 1000 entries, then the next 1000 entries:

for(const {key, value} of store.getRange({limit: 1000})){
    ....
}
for(const {key, value} of store.getRange({offset:1000, limit: 1000})){
    ....
}

Or does something like this already exist?

kriszyp commented 3 years ago

It does not exist yet, but it is a very good idea. Will look into adding it.

kylebernhardy commented 3 years ago

Thank you! That option will be very helpful.

kriszyp commented 3 years ago

Published v1.0.1, let me know if you see anything missing there.

kylebernhardy commented 3 years ago

Thank you, I am working on wiring this feature into our product today. I'll keep this thread open in case any issues emerge.

kylebernhardy commented 3 years ago

Confirming all worked well. Closing request.