3 ms·
Given the confusion over the reuse of the term “cursor”, I prefer the terms we (Google) have settled on for Pagination [1]: page token and page size. It’s often
by boulos 6y ago
Given the confusion over the reuse of the term “cursor”, I prefer the terms we (Google) have settled on for Pagination [1]: page token and page size. It’s often awkward to argue about “really, do I need to support pagination from the outset”, but the examples given in that AIP are from real-world battle scars. Even if you just set the page size to a big number, at least you prepare your callers for “one day, you’ll need to handle this”.
[1] https://google.aip.dev/158 https://google.aip.dev/158
- deleted 6y ago[deleted]
- graderjs 6y agoNot contradicting, just adding that GCP (Datastore) has had cursors for at least 8 years. When I came across that using App Engine many years ago I really liked the cursor thing, and it stuck with me. I found it a little funny this article sounded a bit like "Here's this new thing"
- knorker 6y agoIt's definitely not new, but worth repeating. But yes, I'm surprised it would show up on hackerNEWS.
- boulos 6y agoOh, but that’s an “API” for a Database. So that’s a fine exception to “you should offer cursors”, since that’s what you actually intend to present. A more generic API that happens to be backed by a database with a list of things in it, should not reflect the underlying database decisions if it can help it.
- graderjs 6y agoIt seems to me you might have meant to reply to another comment. This is not an "exception to 'you should offer cursors'" this is offering cursors.