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)
Included Modules
Defined in:
marten/db/query/paginator.crmarten/template/ext/db/query/paginator.cr
Constructors
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
- #resolve_template_attribute(key : String)
Macros inherited from module Marten::Template::Object
template_attributes(*names)
template_attributes
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.