Ecto.Paging

Deps StatusBuild StatusCoverage Status

This module provides a easy way to apply cursor-based pagination to your Ecto Queries.

Usage:

  1. Add macro to your repo
```elixir
defmodule MyRepo do
  use Ecto.Repo, otp_app: :my_app
  use Ecto.Paging.Repo # This string adds `paginate/2` and `page/3` methods.
end
```
  1. Paginate!
```elixir
query = from p in Ecto.Paging.Schema

{res, next_paging} = query
|> Ecto.Paging.TestRepo.page(%Ecto.Paging{limit: 150})
```

Limitations:

Installation

  1. Add ecto_paging to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:ecto_paging, "~> 0.7.0"}]
end
```
  1. Ensure ecto_paging is started before your application:
```elixir
def application do
  [applications: [:ecto_paging]]
end
```