{"id":19733753,"url":"https://github.com/h2337/cppdataloader","last_synced_at":"2025-08-13T06:41:41.661Z","repository":{"id":124233926,"uuid":"531284544","full_name":"h2337/cppdataloader","owner":"h2337","description":"cppdataloader is a batching and caching library for C++17","archived":false,"fork":false,"pushed_at":"2025-07-19T17:04:13.000Z","size":4,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-04T08:58:44.150Z","etag":null,"topics":["batch","batching","cache","caching","cpp","cpp17","dataloader"],"latest_commit_sha":null,"homepage":"","language":"C++","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/h2337.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-08-31T22:51:14.000Z","updated_at":"2025-07-19T17:04:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4f0433a-cf1d-49c2-afe0-fb983361ccdd","html_url":"https://github.com/h2337/cppdataloader","commit_stats":null,"previous_names":["h2337/cppdataloader","hikmat2337/cppdataloader","jafarlihi/cppdataloader"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/h2337/cppdataloader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2337%2Fcppdataloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2337%2Fcppdataloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2337%2Fcppdataloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2337%2Fcppdataloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h2337","download_url":"https://codeload.github.com/h2337/cppdataloader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h2337%2Fcppdataloader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270197921,"owners_count":24543466,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["batch","batching","cache","caching","cpp","cpp17","dataloader"],"created_at":"2024-11-12T00:33:28.407Z","updated_at":"2025-08-13T06:41:41.616Z","avatar_url":"https://github.com/h2337.png","language":"C++","readme":"# cppdataloader\n\ncppdataloader is a batching and caching library for C++17.\n\ncppdataloader is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching.\n\n## Features\n- [x] Batching\n- [x] Caching\n- [x] Direct dispatch\n- [ ] Timeout dispatch\n- [ ] Empty values\n\n## Quickstart\n\ncppq is a header-only library with no dependencies.\n\nJust include the header: `#include \"cppdataloader.h\"`.\n\n## Example\n\n```c++\n#include \"cppdataloader.hpp\"\n\n#include \u003ciostream\u003e\n\nclass User {\n  public:\n    User(long _id): id(_id) {}\n    long id;\n};\n\nclass UserBatchLoader : public BatchLoader\u003clong, User\u003e {\n  public:\n    std::vector\u003cUser\u003e load(std::vector\u003clong\u003e userIds) const override {\n      auto result = std::vector\u003cUser\u003e();\n      // Make a DB call here or something and pass in userIds to SELECT and return\n      for (auto userId : userIds)\n        result.push_back(User(userId));\n      // Results should be in the same order as passed-in IDs\n      return result;\n    }\n};\n\nint main(int argc, char *argv[]) {\n  UserBatchLoader userBatchLoader = UserBatchLoader();\n  DataLoader\u003clong, User\u003e userLoader = DataLoader(userBatchLoader);\n\n  std::future\u003cUser\u003e load1 = userLoader.load(1);\n  std::future\u003cUser\u003e load2 = userLoader.load(2);\n  // Since this fetches the same ID of `1`, it will return the cached value\n  std::future\u003cUser\u003e load3 = userLoader.load(1);\n\n  // Both calls to `load` will be batched and executed with this call\n  userLoader.dispatch();\n\n  std::cout \u003c\u003c load1.get().id \u003c\u003c \" \" \u003c\u003c load2.get().id \u003c\u003c \" \" \u003c\u003c load3.get().id \u003c\u003c std::endl;\n}\n```\n\n## License\n\ncppdataloader is MIT-licensed.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2337%2Fcppdataloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh2337%2Fcppdataloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2337%2Fcppdataloader/lists"}