Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - Nebo15/ecto_paging: Cursor-based pagination for Ecto.

Cursor-based pagination for Ecto. Contribute to Nebo15/ecto_paging development by creating an account on GitHub.

Visit SiteGitHub - Nebo15/ecto_paging: Cursor-based pagination for Ecto.

GitHub - Nebo15/ecto_paging: Cursor-based pagination for Ecto.

Cursor-based pagination for Ecto. Contribute to Nebo15/ecto_paging development by creating an account on GitHub.

Powered by 0x5a.live ๐Ÿ’—

Ecto.Paging

Deps Status Build Status Coverage Status

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

Usage:

  1. Add macro to your repo

    defmodule MyRepo do
       use Ecto.Repo, otp_app: :my_app
       use Ecto.Paging.Repo # This string adds `paginate/2` and `page/3` methods.
     end
    
  2. Paginate!

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

Limitations:

  • Right now it works only with schemas that have :inserted_at field with auto-generated value.
  • You need to be careful with order-by's in your queries, since this feature is not tested yet.
  • It doesn't construct has_more and size counts in paginate struct (TODO: add this helpers).
  • When both starting_after and ending_before is set, only starting_after is used.

Installation

  1. Add ecto_paging to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:ecto_paging, "~> 0.8.4"}]
end
```

2. Ensure ecto_paging is started before your application:

 ```elixir
 def application do
   [applications: [:ecto_paging]]
 end
 ```

Elixir Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.