{"id":32166313,"url":"https://github.com/or-equals/pager","last_synced_at":"2026-02-22T22:39:13.836Z","repository":{"id":62430253,"uuid":"426332747","full_name":"or-equals/pager","owner":"or-equals","description":"A simple pagination library for Elixir","archived":false,"fork":false,"pushed_at":"2025-02-11T18:55:14.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-21T15:06:29.309Z","etag":null,"topics":["ecto","elixir","pagination"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/pager/Pager.html","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/or-equals.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-09T17:58:42.000Z","updated_at":"2025-08-25T17:01:47.000Z","dependencies_parsed_at":"2022-11-01T20:21:02.443Z","dependency_job_id":null,"html_url":"https://github.com/or-equals/pager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/or-equals/pager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-equals%2Fpager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-equals%2Fpager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-equals%2Fpager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-equals%2Fpager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/or-equals","download_url":"https://codeload.github.com/or-equals/pager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/or-equals%2Fpager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29730142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-10-21T15:05:19.448Z","updated_at":"2026-02-22T22:39:13.818Z","avatar_url":"https://github.com/or-equals.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pager\n\nZero-dependency pagination for Ecto queries with automatic page boundary handling and flexible parameter types. [View the documentation](https://hexdocs.pm/pager/Pager.html)\n\n## Features\n\n- Clean API for paginating Ecto queries\n- Handles string and integer page parameters seamlessly\n- Automatic first page redirect when requested page is out of bounds\n- Efficient count queries using subqueries\n- Zero dependencies beyond Ecto\n- Comprehensive pagination metadata\n\n## Installation\n\nAdd `pager` to your dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:pager, \"~\u003e 1.0.0\"}\n  ]\nend\n```\n\n## Usage\n\n```elixir\nimport Ecto.Query\nalias YourApp.Repo\nalias YourApp.Post\n\n# Basic query pagination\nquery = from(p in Post)\nresult = Pager.page(query, Repo, 1, 20)\n\n# Handle Phoenix params directly\ndef index(conn, %{\"page\" =\u003e page, \"per_page\" =\u003e per_page}) do\n  query = from(p in Post, order_by: [desc: :inserted_at])\n  pages = Pager.page(query, Repo, page, per_page)\n  render(conn, \"index.html\", posts: pages.list)\nend\n```\n\n### Return Structure\n\n```elixir\n%{\n  has_next: true,          # More pages available\n  has_prev: false,         # Previous pages available\n  prev_page: 0,           # Previous page number\n  page: 1,                # Current page\n  next_page: 2,           # Next page number\n  first: 1,               # First item index\n  last: 20,               # Last item index\n  count: 50,             # Total items\n  list: [%Post{}, ...]   # Page items\n}\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-feature`)\n3. Commit your changes (`git commit -am 'Add feature'`)\n4. Push to the branch (`git push origin my-feature`)\n5. Create a Pull Request\n\n### Development Setup\n\n1. Create repo for tests:\n```bash\nMIX_ENV=test mix ecto.create\nMIX_ENV=test mix ecto.migrate\nmix test\n```\n\n### Generating Documentation\n\n```bash\nmix docs\nopen doc/index.html\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2For-equals%2Fpager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2For-equals%2Fpager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2For-equals%2Fpager/lists"}