spring-data-commons
spring-data-commons copied to clipboard
Investigate possibility of `Window.hasPrevious()`
For scrolling across results, we already provide a hasNext indicator. It would be good to have a hasPrevious state as well.
For offset-based scrolling, we can get the information from the offset (e.g. a scroll that starts at offset 1 will not have a previous page). For keyset-scrolling, we would need to read from the current cursor and read another item more (two more in total) to determine a previous and next indicator).
It seems sufficient to check the scrollPosition that was passed to the query. If the isInitial() method on the passed ScrollPosition returns false, we can assume that there is a previous window.