{"id":22650560,"url":"https://github.com/bleacherreport/ecto_cursor_pagination","last_synced_at":"2025-04-12T03:12:15.375Z","repository":{"id":57492965,"uuid":"62077617","full_name":"bleacherreport/ecto_cursor_pagination","owner":"bleacherreport","description":"Ecto Plugin for Cursor Pagination","archived":false,"fork":false,"pushed_at":"2017-02-06T21:31:42.000Z","size":19,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-03-25T22:41:32.450Z","etag":null,"topics":["ecto","elixir","pagination"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bleacherreport.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-27T18:14:52.000Z","updated_at":"2022-12-22T19:08:57.000Z","dependencies_parsed_at":"2022-08-28T11:51:11.548Z","dependency_job_id":null,"html_url":"https://github.com/bleacherreport/ecto_cursor_pagination","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleacherreport%2Fecto_cursor_pagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleacherreport%2Fecto_cursor_pagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleacherreport%2Fecto_cursor_pagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleacherreport%2Fecto_cursor_pagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bleacherreport","download_url":"https://codeload.github.com/bleacherreport/ecto_cursor_pagination/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248298351,"owners_count":21080320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecto","elixir","pagination"],"created_at":"2024-12-09T08:34:55.482Z","updated_at":"2025-04-12T03:12:15.358Z","avatar_url":"https://github.com/bleacherreport.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ecto.CursorPagination\n[![Hex pm](http://img.shields.io/hexpm/v/ecto_cursor_pagination.svg?style=flat)](https://hex.pm/packages/ecto_cursor_pagination)\n[![Build Status](https://travis-ci.org/bleacherreport/ecto_cursor_pagination.svg?branch=master)](https://travis-ci.org/bleacherreport/ecto_cursor_pagination)\n[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://github.com/bleacherreport/plug_logger_json/blob/master/LICENSE)\n\nCursor Pagination\n\nGood Explanation of why cursor pagination is superior to offset/limit:\n\n[http://blog.novatec-gmbh.de/art-pagination-offset-vs-value-based-paging/](http://blog.novatec-gmbh.de/art-pagination-offset-vs-value-based-paging/)\n[https://www.percona.com/files/presentations/ppc2009/PPC2009_mysql_pagination.pdf](https://www.percona.com/files/presentations/ppc2009/PPC2009_mysql_pagination.pdf)\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed as:\n\n  1. Add `ecto_cursor_pagination` to your list of dependencies in `mix.exs`:\n\n    ```elixir\n    def deps do\n      [{:ecto_cursor_pagination, \"~\u003e 0.1.1\"}]\n    end\n    ```\n\n  2. Ensure `ecto_cursor_pagination` is started before your application:\n\n    ```elixir\n    def application do\n      [applications: [:ecto_cursor_pagination]]\n    end\n    ```\n\n### Recommended Setup\n  * Configure this application\n    * Add to your `config/config.exs` or each `config/env_name.exs`:\n\n            config :ecto_cursor_pagination,\n              per_page: 15,\n              cursor_id: :id\n\n## Example controller Action\n\n    def index(conn, params) do\n      last_seen_param = Map.get(params, \"last_seen_id\", \"\")\n      direction_param = Map.get(params, \"dir\", \"\")\n\n      query = Todo\n              |\u003e filter_by_uuid(\"user_id\", params[\"user_id\"])\n              |\u003e filter_by_string(\"name\", params[\"name\"])\n              |\u003e filter_by_string(\"type\", params[\"type\"])\n      query = Ecto.CursorPagination.paginate(query, last_seen_param, direction_param)\n\n      render(conn, \"index.json\", data: MyApp.Repo.all(query))\n    end\n\n## Contributing\nBefore submitting your pull request, please run:\n  * `mix credo --strict`\n  * `mix coveralls`\n  * `mix dialyzer`\n\nPlease squash your pull request's commits into a single commit with a message and\ndetailed description explaining the commit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbleacherreport%2Fecto_cursor_pagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbleacherreport%2Fecto_cursor_pagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbleacherreport%2Fecto_cursor_pagination/lists"}