FatEcto.FatPaginator behaviour (FatEcto v1.1.0)
View SourceProvides pagination functionality for Ecto queries.
This module can be used to paginate query results by specifying limit
and skip
parameters.
It also supports counting the total number of records for pagination metadata.
Usage
defmodule Fat.MyContext do
use FatEcto.FatPaginator, repo: Fat.Repo, default_limit: 10, max_limit: 100
# Custom functions can be added here
end
Now you can use the paginate/2
, paginator/3
, and paginate_get_records/3
functions within Fat.MyContext
.
Summary
Functions
Callback function that runs after the module is compiled.
Callbacks
@callback aggregate(Ecto.Query.t()) :: Ecto.Query.t()
@callback count_query(Ecto.Query.t()) :: Ecto.Query.t()
@callback data_query(Ecto.Query.t(), integer(), integer()) :: Ecto.Query.t()