{"id":13513876,"url":"https://github.com/absinthe-graphql/dataloader","last_synced_at":"2025-03-31T02:33:01.003Z","repository":{"id":41322032,"uuid":"106183076","full_name":"absinthe-graphql/dataloader","owner":"absinthe-graphql","description":"DataLoader for Elixir","archived":false,"fork":false,"pushed_at":"2024-10-02T16:27:04.000Z","size":2776,"stargazers_count":490,"open_issues_count":12,"forks_count":99,"subscribers_count":19,"default_branch":"main","last_synced_at":"2024-10-30T02:03:50.699Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/absinthe-graphql.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2017-10-08T14:34:37.000Z","updated_at":"2024-10-19T11:07:23.000Z","dependencies_parsed_at":"2024-01-13T17:03:43.653Z","dependency_job_id":"f6838f75-92fe-407c-8bdd-21329da052e4","html_url":"https://github.com/absinthe-graphql/dataloader","commit_stats":{"total_commits":230,"total_committers":45,"mean_commits":5.111111111111111,"dds":0.6260869565217391,"last_synced_commit":"fec73cb9f1e5400b20231cf1548838005f58fc26"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/absinthe-graphql%2Fdataloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/absinthe-graphql%2Fdataloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/absinthe-graphql%2Fdataloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/absinthe-graphql%2Fdataloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/absinthe-graphql","download_url":"https://codeload.github.com/absinthe-graphql/dataloader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246260402,"owners_count":20748843,"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":[],"created_at":"2024-08-01T05:00:39.386Z","updated_at":"2025-03-31T02:33:00.524Z","avatar_url":"https://github.com/absinthe-graphql.png","language":"Elixir","readme":"# Dataloader\n\n[![Build Status](https://github.com/absinthe-graphql/dataloader/workflows/CI/badge.svg)](https://github.com/absinthe-graphql/dataloader/actions?query=workflow%3ACI)\n[![Version](https://img.shields.io/hexpm/v/dataloader.svg)](https://hex.pm/packages/dataloader)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/dataloader/)\n[![Download](https://img.shields.io/hexpm/dt/dataloader.svg)](https://hex.pm/packages/dataloader)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Last Updated](https://img.shields.io/github/last-commit/absinthe-graphql/dataloader.svg)](https://github.com/absinthe-graphql/dataloader/commits/master)\n\nDataloader provides an easy way efficiently load data in batches. It's inspired\nby [https://github.com/facebook/dataloader](https://github.com/facebook/dataloader), although it makes some small API changes to better suit Elixir use cases.\n\n## Installation\n\nThe package can be installed by adding [`:dataloader`](https://hex.pm/packages/dataloader) to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:dataloader, \"~\u003e 2.0.0\"}\n  ]\nend\n```\n\nNote: Dataloader requires Elixir 1.10 or higher.\n\n## Upgrading\n\nSee [CHANGELOG](./CHANGELOG.md) for upgrade steps between versions.\n\n## Documentation\n\n- [Dataloader hexdocs](https://hexdocs.pm/dataloader).\n- For the tutorial, guides, and general information about Absinthe-related\n  projects, see [http://absinthe-graphql.org](http://absinthe-graphql.org).\n\n## Usage\n\nCentral to Dataloader is the idea of a source. A single Dataloader struct can\nhave many different sources, which represent different ways to load data.\n\nHere's an example of a data loader using an Ecto source, and then loading some\norganization data.\n\n```elixir\nsource = Dataloader.Ecto.new(MyApp.Repo)\n\n# setup the loader\nloader = Dataloader.new |\u003e Dataloader.add_source(:db, source)\n\n# load some things\nloader =\n  loader\n  |\u003e Dataloader.load(:db, Organization, 1)\n  |\u003e Dataloader.load_many(:db, Organization, [4, 9])\n\n# actually retrieve them\nloader = Dataloader.run(loader)\n\n# Now we can get whatever values out we want\norganizations = Dataloader.get_many(loader, :db, Organization, [1,4])\n```\n\nThis will do a single SQL query to get all organizations by ids 1, 4, and 9. You\ncan load multiple batches from multiple sources, and then when `run/1` is called\nbatch will be loaded concurrently.\n\nHere we named the source `:db` within our dataloader. More commonly though if\nyou're using Phoenix you'll want to name it after one of your contexts, and have\na different source used for each context. This provides an easy way to enforce\ndata access rules within each context. See the `Dataloader.Ecto` moduledocs for\nmore details\n\n### Sources\n\nDataloader ships with two different built in sources. The first is the Ecto source for easily pulling out data with ecto. The other is a simple `KV` key value source. See each module for its respective documentation.\n\nAnything that implements the `Dataloader.Source` protocol can act as a source.\n\n## Community\n\nThe project is under constant improvement by a growing list of\ncontributors, and your feedback is important. Please join us in Slack\n(`#absinthe-graphql` under the Elixir Slack account) or the Elixir Forum\n(tagged `absinthe`).\n\nPlease remember that all interactions in our official spaces follow\nour [Code of Conduct](./CODE_OF_CONDUCT.md).\n\n## Related Projects\n\nSee the [GitHub organization](https://github.com/absinthe-graphql).\n\n## Contributing\n\nPlease follow [contribution guide](./CONTRIBUTING.md).\n\n## License\n\nSee [LICENSE.md](./LICENSE.md).\n","funding_links":[],"categories":["Elixir","Running the update"],"sub_categories":["By Popularity"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabsinthe-graphql%2Fdataloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabsinthe-graphql%2Fdataloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabsinthe-graphql%2Fdataloader/lists"}