{"id":15019644,"url":"https://github.com/nfibrokerage/fob","last_synced_at":"2025-10-24T14:31:21.877Z","repository":{"id":43127631,"uuid":"342355995","full_name":"NFIBrokerage/fob","owner":"NFIBrokerage","description":"A minimalistic keyset pagination library for Ecto queries","archived":false,"fork":false,"pushed_at":"2024-08-28T15:17:13.000Z","size":104,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-02-06T12:12:05.388Z","etag":null,"topics":["cursor","ecto","keyset","library","pagination","postgresql"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/fob","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/NFIBrokerage.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-25T19:27:29.000Z","updated_at":"2024-08-28T15:13:45.000Z","dependencies_parsed_at":"2024-08-27T17:46:39.021Z","dependency_job_id":"3c4db115-57ae-42ed-b954-99ae9049442c","html_url":"https://github.com/NFIBrokerage/fob","commit_stats":{"total_commits":43,"total_committers":3,"mean_commits":"14.333333333333334","dds":0.2325581395348837,"last_synced_commit":"b83a39f97dfa9a1abd4e449b581565868ccf8f12"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NFIBrokerage%2Ffob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NFIBrokerage%2Ffob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NFIBrokerage%2Ffob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NFIBrokerage%2Ffob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NFIBrokerage","download_url":"https://codeload.github.com/NFIBrokerage/fob/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237982368,"owners_count":19397250,"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":["cursor","ecto","keyset","library","pagination","postgresql"],"created_at":"2024-09-24T19:53:50.029Z","updated_at":"2025-10-24T14:31:18.134Z","avatar_url":"https://github.com/NFIBrokerage.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fob\n\n![Actions CI](https://github.com/NFIBrokerage/fob/workflows/Actions%20CI/badge.svg)\n\nA minimalistic keyset pagination library for Ecto queries\n\n**N.B.**: you probably don't want to use Fob. Fob makes a number of assumptions\nabout the queries passed to it, such as:\n\n- each schema will have only one primary key\n- each query must be ordered by at least the schema's primary key\n- the primary key is always the final ordering condition\n- associations are untested and probably do not work\n    - (left) joins are known to work though\n\n## Usage\n\nFob works primarily by composing Ecto queries with `Ecto.Query.where/3` and\n`Ecto.Query.limit/2`. In general, the tracking of page breaks is left to any\nconsuming library/application, but Fob provides a convenience tool which it\nuses internally for easy testing: `Fob.Cursor`.\n\nA `Fob.Cursor` is a similar idea to a standard elixir `Stream` except that it\ndoes not represent an active connection to a resource (some but not all Elixir\n`Stream`s open a process or port and therefore represent a connection to\nresource. This disallows some functionality which is desirable for Fob, such\nas [`Stream.split/2`](https://github.com/elixir-lang/elixir/issues/2922)).\n\nWith the cursor, you may walk through the pages of a dataset with\n`Fob.Cursor.next/1` and take multiple pages with `Fob.Cursor.split/2`\n\n```elixir\niex\u003e alias Fob.Cursor\niex\u003e import Ecto.Query, only: [order_by: 2]\niex\u003e cursor = Cursor.new(order_by(MySchema, asc: :id), MyApp.Repo, _initial_pagination = nil, _page_size = 3)\n#Fob.Cursor\u003c...\u003e\niex\u003e {_records, cursor} = Cursor.next(cursor)\n{[%{id: 1}, %{id: 2}, %{id: 3}], #Fob.Cursor\u003c...\u003e}\niex\u003e {_records, cursor} = Cursor.next(cursor)\n{[%{id: 4}, %{id: 5}, %{id: 6}], #Fob.Cursor\u003c...\u003e}\niex\u003e {_records, cursor} = Cursor.split(cursor, 2)\n{[%{id: 7}, %{id: 8}, %{id: 9}, %{id: 10}, %{id: 11}, %{id: 12}], #Fob.Cursor\u003c...\u003e}\n```\n\n## Why?\n\nWhy build an incomplete and minimal keyset pagination\nlibrary when there are already workable implementations in\n[Paginator](https://github.com/duffelhq/paginator) and\n[Quarto](https://github.com/maartenvanvliet/quarto)? Fob was originally cut\nout of another library called Haste. In our setup, Haste satisfies all of the\nabove assumptions.\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:fob, \"~\u003e 1.0\"}\n  ]\nend\n```\n\nCheck out the docs here: https://hexdocs.pm/fob\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfibrokerage%2Ffob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfibrokerage%2Ffob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfibrokerage%2Ffob/lists"}