PanacheQuery.range()
See original GitHub issueDescription PanacheQuery support a paging mechanism that allow to fetch the result of a query page by page. This is handy to list all the result of a query but not to give an external application the capability to fetch all the results.
Moreover, paging is statefull as it implies to store the size of the page and the current page index.
In API developement, range query is often implemented by providing an extra query parameter ?range=0-10, this is suitable to be used with HTTP range headers defined in the follwing RFC; https://tools.ietf.org/html/rfc7233
Building such range capability where a user can ask for any range within the list of result is not suitable with the current paging implementation.
So I propose to add a PanacheQuery.range() method for this.
Implementation ideas
Add a PanacheQuery.range(startIdx, endIdx) method that will allow to set offset and limit on the generated SQL query as the current paging mechanism do.
If it’s OK, I can works on a PR for this.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:22 (21 by maintainers)
Top Related StackOverflow Question
I would also be interested in a standard
offset/limitquery.I also have a use case for this, where the current paging approach makes it hard to implement.