class Marten::DB::Query::Paginator(M)
- Marten::DB::Query::Paginator(M)
- Reference
- Object
Overview
A query set paginator.
Paginators can be used to paginate the records that are targeted by a specific query set:
query_set = Post.all
query_set.paginator.page(2)
Defined in:
marten/db/query/paginator.crConstructors
Instance Method Summary
-
#page(number : Int)
Returns a specific page.
-
#page!(number : Int)
Returns a specific page.
- #page_size
-
#pages_count
Returns the number of pages.
- #queryset
Constructor Detail
Instance Method Detail
def page(number : Int)
#
Returns a specific page.
This method returns the Marten::DB::Query::Page
object corresponding to the passed number
. If the page
number does not correspond to any existing page, the latest page is returned.
def page!(number : Int)
#
Returns a specific page.
This method returns the Marten::DB::Query::Page
object corresponding to the passed number
. If the page
number does not correspond to any existing page, a Marten::DB::Query::Paginator::EmptyPageError
exception is
raised.