{"id":17600259,"url":"https://github.com/mtwilliams/bourne","last_synced_at":"2025-08-24T10:02:53.927Z","repository":{"id":57480560,"uuid":"83934322","full_name":"mtwilliams/bourne","owner":"mtwilliams","description":":speedboat: Better streaming for Ecto.","archived":false,"fork":false,"pushed_at":"2019-12-19T16:07:27.000Z","size":20,"stargazers_count":75,"open_issues_count":4,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T12:33:32.931Z","etag":null,"topics":["ecto","elixir","genstage","streaming"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtwilliams.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":"2017-03-05T00:34:55.000Z","updated_at":"2024-09-04T13:40:55.000Z","dependencies_parsed_at":"2022-09-26T17:41:15.706Z","dependency_job_id":null,"html_url":"https://github.com/mtwilliams/bourne","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtwilliams%2Fbourne","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtwilliams%2Fbourne/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtwilliams%2Fbourne/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtwilliams%2Fbourne/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtwilliams","download_url":"https://codeload.github.com/mtwilliams/bourne/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681598,"owners_count":21144715,"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","genstage","streaming"],"created_at":"2024-10-22T11:10:13.671Z","updated_at":"2025-04-13T08:21:17.971Z","avatar_url":"https://github.com/mtwilliams.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bourne\n\n[![Continuous Integration](https://img.shields.io/travis/mtwilliams/bourne/master.svg)](https://travis-ci.org/mtwilliams/bourne)\n[![Code Coverage](https://img.shields.io/coveralls/mtwilliams/bourne/master.svg)](https://coveralls.io/github/mtwilliams/bourne)\n[![Documentation](http://inch-ci.org/github/mtwilliams/bourne.svg)](http://inch-ci.org/github/mtwilliams/bourne)\n[![Package](https://img.shields.io/hexpm/v/bourne.svg)](https://hex.pm/packages/bourne)\n\nBourne provides more powerful streaming mechanisms than those offered by [Ecto](https://github.com/elixir-ecto/ecto) or [Tributary](https://github.com/DavidAntaramian/tributary). Notably, it provides both *cursor* and *keyset* pagination methods, as well as the ability to create a `GenStage` producer with similar semantics to `GenStage.from_enumerable`.\n\n## Example\n\n```elixir\ndefmodule My.Repo do\n  use Ecto.Repo, otp_app: :mine\n  use Bourne\nend\n\nimport Ecto.Query\nq = from(actor in Actor, where: actor.born \u003c= 1980)\n\n# You can stream through an `Enumerable`:\nMy.Repo.stream(q) |\u003e Stream.each(\u0026IO.inspect) |\u003e Stream.run\n\n# Alternatively, you can stream through a GenStage producer:\ndefmodule InspectorConsumer do\n  use GenStage\n\n  def start_link do\n    GenStage.start_link(InspectorConsumer, [])\n  end\n\n  def init([]) do\n    {:consumer, :ok}\n  end\n\n  def handle_events(rows, _from, state) do\n    Enum.each(rows, \u0026IO.inspect/1)\n    {:noreply, [], state}\n  end\nend\n\nmethod = Enum.take_random(~W{cursor keyset}a, 1)\n{:ok, producer} = My.Repo.streamer(q, method: method)\n{:ok, consumer} = InspectorConsumer.start_link\nGenStage.sync_subscribe(consumer, to: producer)\n```\n\n## Installation\n\n  1. Add `bourne` to your list of dependencies in `mix.exs`:\n\n  ```elixir\n  def deps do\n    [{:bourne, \"~\u003e 1.0\"}]\n  end\n  ```\n\n  2. Fetch and compile your new dependency:\n\n  ```\n  mix do deps.get bourne, deps.compile\n  ```\n\n  3. Drink your :tea:\n\n  4. That's it!\n\n## Usage\n\nRefer to the [documentation](https://hexdocs.pm/bourne/Bourne.html).\n\n## License\n\nBourne is free and unencumbered software released into the public domain, with fallback provisions for jurisdictions that don't recognize the public domain.\n\nFor details, see `LICENSE.md`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtwilliams%2Fbourne","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtwilliams%2Fbourne","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtwilliams%2Fbourne/lists"}