{"id":30844026,"url":"https://github.com/eldment/lin-q","last_synced_at":"2025-09-06T22:07:36.323Z","repository":{"id":310503030,"uuid":"1040108272","full_name":"ELDment/Lin-Q","owner":"ELDment","description":"📈 为 C++ 打造的高性能、纯头文件 LINQ 风格查询库 📦 High-performance, header-only, LINQ-style query library for C++","archived":false,"fork":false,"pushed_at":"2025-08-18T13:28:45.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-18T15:28:55.950Z","etag":null,"topics":["cpp","cpp17","header-only","high-performance","library","linq","linq-style","mordern-cpp","powerful"],"latest_commit_sha":null,"homepage":"https://github.com/ELDment/Lin-Q/blob/main/src/LinQ.hpp","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ELDment.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,"zenodo":null}},"created_at":"2025-08-18T13:20:27.000Z","updated_at":"2025-08-18T13:40:44.000Z","dependencies_parsed_at":"2025-08-18T15:29:03.257Z","dependency_job_id":"a2c0df00-dd67-4b95-bed5-0e1b0aabef14","html_url":"https://github.com/ELDment/Lin-Q","commit_stats":null,"previous_names":["eldment/lin-q"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ELDment/Lin-Q","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELDment%2FLin-Q","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELDment%2FLin-Q/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELDment%2FLin-Q/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELDment%2FLin-Q/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ELDment","download_url":"https://codeload.github.com/ELDment/Lin-Q/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ELDment%2FLin-Q/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273968667,"owners_count":25199652,"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-09-06T02:00:13.247Z","response_time":2576,"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":["cpp","cpp17","header-only","high-performance","library","linq","linq-style","mordern-cpp","powerful"],"created_at":"2025-09-06T22:07:34.940Z","updated_at":"2025-09-06T22:07:36.312Z","avatar_url":"https://github.com/ELDment.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lin-Q\n\n**English** | [简体中文](README.zh-CN.md)\n\nA simple, header-only, easy-to-use, and high-performance LINQ-like query library for C++ 🚀\n\nThis library provides a powerful set of query operations for collections, inspired by .NET's Language Integrated Query (LINQ)\n\n## ✨ Features\n\n- **📑 Header-only**: Just include `LinQ.hpp` to get started\n- **⌛ Deferred Execution**: Operations like `Where` and `Select` are deferred until the results are actually needed\n- **🎩 Powerful API**:\n  - Filtering: `Where`\n  - Projection: `Select`\n  - Sorting: `OrderBy`, `OrderByDescending`, `ThenBy`\n  - Aggregation: `Sum`, `Count`, `Average`, `Min`, `Max`\n  - Element: `First`, `FirstOrDefault`, `Last`, `LastOrDefault`, `ElementAt`\n  - Quantifiers: `Any`, `All`\n  - Set: `Distinct`, `Union`, `Intersect`, `Except`\n  - Conversion: `ToVector`, `ToMap`, `ToUnorderedMap`, `ToArray`, `ToCArray`\n  - ...\n\n## 🛠️ Building the Project\n\n### Using xmake\n\n```bash\nxmake\nxmake run example\n```\n\n### Using CMake\n\n```bash\nmkdir build\ncd build\ncmake ..\ncmake --build .\n# Run the executable\n./Release/example.exe\n```\n\n## 🚀 Usage Example\n\n```cpp\n#include \"LinQ.hpp\"\n#include \u003ciostream\u003e\n#include \u003cstring\u003e\n#include \u003cvector\u003e\n\nint main() {\n  // Test with an integer array\n  int intArray[] = {1, 2, 3, 4, 5};\n  auto intQuery = LinQ::From(intArray)\n                    .Select([](int x) { return x * x; });\n\n  for (auto x : intQuery) {\n    std::cout \u003c\u003c x \u003c\u003c \" \"; // Output: 1 4 9 16 25\n  }\n  std::cout \u003c\u003c std::endl;\n\n  // Test with a vector of strings\n  std::vector\u003cstd::string\u003e stringVector = {\"apple\", \"banana\", \"cherry\", \"date\", \"fig\"};\n  auto stringQuery = LinQ::From(stringVector)\n                          .Where([](const std::string\u0026 s) { return s.length() \u003e 4; })\n                          .Select([](const std::string\u0026 s) {\n                            std::string upperString = s;\n                            std::transform(upperString.begin(), upperString.end(), upperString.begin(), ::toupper);\n                            return upperString;\n                          })\n                          .OrderByDescending([](const std::string\u0026 s) { return s; });\n\n  for (const auto\u0026 s : stringQuery) {\n    std::cout \u003c\u003c s \u003c\u003c \" \"; // Output: CHERRY BANANA APPLE\n  }\n  std::cout \u003c\u003c std::endl;\n\n  // Test ToMap with a single argument\n  struct Person {\n    int id;\n    std::string name;\n  };\n  std::vector\u003cPerson\u003e people = {{1, \"ELDment\"}, {2, \"Ambr0se\"}, {3, \"利世\"}};\n\n  auto personMap = LinQ::From(people).ToMap([](const Person\u0026 p) { return p.id; });\n\n  for (const auto\u0026 pair : personMap) {\n    std::cout \u003c\u003c \"[\" \u003c\u003c pair.first \u003c\u003c \": \" \u003c\u003c pair.second.name \u003c\u003c \"] \"; // Output: [1: ELDment] [2: Ambr0se] [3: 利世]\n  }\n  std::cout \u003c\u003c std::endl;\n\n  return 0;\n}\n```\n\n## 🤝 Contributing\n\nContributions, issues, and feature requests are welcome!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldment%2Flin-q","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldment%2Flin-q","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldment%2Flin-q/lists"}