This module creates pages that group results.
?- pagination(N, between(1, 1000000, N), options{page: 856}, Result).
Result = _G120{number_of_results:20, page:856, page_size:20, results:[17101, 17102, 17103, 17104, 17105, 17106, 17107, 17108|...]} ;
Result = _G147{number_of_results:20, page:857, page_size:20, results:[17121, 17122, 17123, 17124, 17125, 17126, 17127, 17128|...]} ;
Result = _G147{number_of_results:20, page:858, page_size:20, results:[17141, 17142, 17143, 17144, 17145, 17146, 17147, 17148|...]}
- pagination(+Templ, :Goal_0, -Page:dict) is det
- pagination(+Templ, :Goal_0, +Options:options, -Page:dict) is det
- pagination(+Templ, :Goal_0, :Estimate_1, +Options:options, -Page:dict) is det
-
- Arguments:
-
Options | - The following options are supported:
- page_number(+nonneg)
- The page number of the Page in the implicit sequence. The
default is 1.
- page_size(+positive_integer)
- The number of results per (full) page. The default is 10.
|
Page | - is a dictionary with the following keys:
- number_of_results(nonneg)
- The number of results on the page. This is either
identical to or less than the value of option page_size/1.
- page_number(positive_integer)
- The page number of the page within the implicit sequence.
- page_size(positive_integer)
- The number of results if the page were full. This is
identical to the value of option page_size/1.
- results(list(term))
- The results that are held by this Page.
- single_page(boolean)
- A dirty hack to allow ‘pagination’ of one page, i.e.,
without ‘next’ links.
- total_number_of_results(nonneg)
- The total number of results, independent of pagination.
This is only present when etimation goal Estimate_1 is
passed.
|
- pagination_bulk(:Goal_1, +Options:options, -Page:dict) is nondet
- pagination_bulk(?Template, :Goal_0, +Options:options, -Page:dict) is nondet
- pagination_is_at_end(+Page:dict) is semidet
- Succeeds if Page is the last page.
Since we do not know the total number of results, the last page may
be empty.
- pagination_is_empty(+Page:dict) is semidet
- pagination_page(+Page:dict, +Relation:atom, -PageNumber:positive_integer) is semidet
- pagination_page(+Page:dict, -Relation:atom, -PageNumber:positive_integer) is nondet
- PageNumber is the first, last, next, and previous page number for
Page.
Fails silently when there is no page with relation Relation.
- Arguments:
-
Relation | - is either `first', `last', `next', or `prev'. |
PageNumber | - is a positive integer. |
- pagination_range(+Page:dict, -Range:pair(nonneg)) is det
- Returns the range of results that is spanned by the given Page.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
- pagination(Arg1, Arg2, Arg3, Arg4)
- pagination(Arg1, Arg2, Arg3, Arg4, Arg5)
- pagination_bulk(Arg1, Arg2, Arg3, Arg4)