Expose more
property on Pagy::Keyset
#734
olivier-thatch
started this conversation in
Feature Requests
Replies: 1 comment
-
That's very welcome! Thank you! I am just not so sure we need it.
Isn't that already possible with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Pagy's keyset implementation queries one more record than actually requested, then checks the number of records returned by the database to determine whether the end of the set has been reached or not:
pagy/gem/lib/pagy/keyset.rb
Lines 64 to 65 in c5a7b92
Currently,
@more
is only used internally and is not exposed to consumers of the API. I think it should: for instance, it would be useful to expose this property in a public API, so that API clients can know whether they've reached the end of the set or not without having to send an additional request.As an example of real-word use, Stripe's API uses cursor-based pagination and its paginated list object includes an
has_more
property.If you think this would be a useful addition to Pagy, I'm happy to submit a PR. It should literally be as simple as adding an
attr_reader
:)Beta Was this translation helpful? Give feedback.
All reactions