timshannon / bolthold

BoltHold is an embeddable NoSQL store for Go types built on BoltDB
MIT License
648 stars 46 forks source link

Add Skip and Limit #1

Closed timshannon closed 7 years ago

timshannon commented 7 years ago

Other databases have options of skip and limit to help with pagination. I'm thinking I'll handle this by adding a Row field selector similar to how you can compare against the Key with bolthold.Key()

So a query may look like this:

bolthold.Where(bolthold.Row()).Ge(0).And(bolthold.Row()).Lt(100))

It allows you to skip and limit.

timshannon commented 7 years ago

While I think bolthold.Row() makes for a better cleaner interface, keeping track of the current row for each index entry along with tracking the row past Seek calls would be impossible, and would mean that implementing Row() correctly would hurt performance. Not worth it. I'll just implement Skip() and Limit() instead.