Create a new PaginatedQuery that uses LIMIT and OFFSET, execute it, and return a Stream over the results.
Create a new PaginatedQuery that uses LIMIT and OFFSET, execute it, and return a Stream over the results.
the RowParser that will parse records from the database
the number of records each page will contain
the offset to start with
the Sql object to use for the query. This object should already have all parameters substituted into it
the connection to use to make the query
a Stream over all the records returned by the query, getting a new page of results when the current one is exhausted
Create a new PaginatedQuery with user supplied queries, execute it, and return a Stream over the results.
Create a new PaginatedQuery with user supplied queries, execute it, and return a Stream over the results. It should be noted that the PaginatedQuery makes absolutely no changes to the supplied query, so users should make sure to include LIMIT and conditional statements in the query.
the RowParser that will parse records from the database
a function that will, optionally given the last record in a page of results, produce a query object that can be executed to get the next page of results. The last record Option will be None when getting the first page of results.
the connection to use to make the query
a Stream over all the records returned by the query, getting a new page of results when the current one is exhausted
The PaginatedQuery companion object supplies apply methods that will create new PaginatedQuery's and execute them to get Streams of results.
PaginatedQuery provides two pagination methods:
The latter method is provided because the LIMIT/OFFSET method has poor performance when result sets get large.