module Clear::SQL::Query::WithPagination

Direct including types

Defined in:


Constant Summary


Instance Method Summary

Instance Method Detail

def current_page #

Return the current page

[View source]
def first_page? #

[View source]
def last_page? #

[View source]
def next_page #

Return current_page + 1 or nil if there is no next page

[View source]
def out_of_bounds? #

Helper method that is true when someone tries to fetch a page with a larger number than the last page. Can be used in combination with flashes and redirecting.

[View source]
def paginate(page : Int32 = DEFAULT_PAGE, per_page : Int32 = DEFAULT_LIMIT) #

Enter pagination mode. This is helpful to manage paginated table. Pagination will handle the page progression automatically and update offset and limit parameters by his own.

page = query.paginate(2, 50)

[View source]
def per_page #

Return the number of items maximum per page.

[View source]
def previous_page #

Return current_page - 1 or nil if there is no previous page

[View source]
def total_pages #

Return the total number of pages.

[View source]