Class KeysetPager

java.lang.Object
com.kingsrook.qqq.backend.core.actions.tables.KeysetPager

public class KeysetPager extends Object
Read a table a page at a time using keyset ("seek") paging, rather than skip/limit: each page is
WHERE (filter) AND pk > lastKey ORDER BY pk ASC LIMIT pageSize
so the cost of a page stays flat no matter how deep into the table it is, and a run can be resumed from the last key it handled (startingAfter(Serializable), getLastKey()). Works against any backend that supports criteria and ordering on the table's single primary key field. Pass a transaction (withTransaction(com.kingsrook.qqq.backend.core.actions.QBackendTransaction)) and every page is read inside it - e.g., inside a consistent-snapshot transaction. Requirements and edge cases: Example:
 KeysetPager.forTable("person")
    .withFilter(new QQueryFilter(new QFilterCriteria("isEmployed", EQUALS, true)))
    .withPageSize(5000)
    .withTransaction(snapshotTransaction)
    .forEachPage(page -> write(page));