class Marten::DB::Query::Paginator(M)

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.cr
marten/template/ext/db/query/paginator.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(queryset : Set(M), page_size : Int32) #

[View source]

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.


[View source]
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.


[View source]
def page_size #

[View source]
def pages_count #

Returns the number of pages.


[View source]
def queryset #

[View source]
def resolve_template_attribute(key : String) #

[View source]