Flop.meta
You're seeing just the function
meta
, go back to Flop module for more information.
Specs
meta(Ecto.Queryable.t() | [any()], t(), [option()]) :: Flop.Meta.t()
Returns meta information for the given query and flop that can be used for building the pagination links.
iex> Flop.meta(Flop.Pet, %Flop{limit: 10}, repo: Flop.Repo)
%Flop.Meta{
current_offset: 0,
current_page: 1,
end_cursor: nil,
flop: %Flop{limit: 10},
has_next_page?: false,
has_previous_page?: false,
next_offset: nil,
next_page: nil,
page_size: 10,
previous_offset: nil,
previous_page: nil,
start_cursor: nil,
total_count: 0,
total_pages: 0
}
The function returns both the current offset and the current page, regardless
of the pagination type. If the offset lies in between pages, the current page
number is rounded up. This means that it is possible that the values for
current_page
and next_page
can be identical. This can only occur if you
use offset/limit based pagination with arbitrary offsets, but in that case,
you will use the previous_offset
, current_offset
and next_offset
values
to render the pagination links anyway, so this shouldn't be a problem.
Unless cursor-based pagination is used, this function will run a query to figure get the total count of matching records.