AntlUtilsEcto.Paginator (antl_utils_ecto v2.13.2)

View Source

Set of utils for Ecto about Pagination

Summary

Functions

paginate(queryable, page_size, page_number)

@spec paginate(any(), pos_integer(), pos_integer()) :: Ecto.Query.t()

Paginate.

Examples

iex> queryable = from u in "products" #Ecto.Query<from p0 in "products"> iex> Paginator.paginate(queryable, 100, 1) #Ecto.Query<from p0 in "products", limit: ^100, offset: ^0> iex> Paginator.paginate(queryable, 100, 2) #Ecto.Query<from p0 in "products", limit: ^100, offset: ^100> iex> Paginator.paginate(queryable, 100, 3) #Ecto.Query<from p0 in "products", limit: ^100, offset: ^200> iex> Paginator.paginate(queryable, 10, 3) #Ecto.Query<from p0 in "products", limit: ^10, offset: ^20>