-
Notifications
You must be signed in to change notification settings - Fork 423
feat: Add offset-based pagination support #3602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add _offset parameter for direct record access - Maintain backward compatibility with token pagination - Include pagination metadata in response - Support for random access pagination
|
This addresses the feature request in #3403 |
leplatrem
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wao! Thank you for taking the time to dive into the code-base and implement this new feature!
Great job, it's a valid idea :)
At this time of the year we are a bit short staffed and a bit busy to review it deeply. But we'll try our best, there are a lot of changes :)
From my first overlook, I can already tell you that before we can merge it, we must add documentation, unit and functional tests.
| <component name="VcsDirectoryMappings"> | ||
| <mapping directory="" vcs="Git" /> | ||
| </component> | ||
| </project> No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want these .idea/ files? I'd say add it to .gitiignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure ill addit:)
| if used_offset_pagination: | ||
| response_data = { | ||
| 'data': result_objects, | ||
| 'pagination': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this new pagination field. If we add it, we must check that it is consistent with everything else, and well documented. There is also the option to use response headers. Kinto responses haven't changed in 10 years 😅
Add Offset-Based Pagination Support
Problem
Currently, Kinto only supports token-based pagination which requires sequential access to records. Users cannot jump directly to specific record positions (e.g., records 100-120) without paging through all previous records.
Solution
This PR adds support for
_offsetparameter alongside the existing token-based pagination, allowing direct access to any record position.Changes
_offsetparameter: Allows specifying starting position for recordsKey Features
GET /records?_limit=20&_offset=100returns records 100-119 directlypaginationobject with limit, offset, total, has_moreAPI Examples