{"id":17246199,"url":"https://github.com/hanson/collection","last_synced_at":"2026-01-23T05:36:57.146Z","repository":{"id":176686330,"uuid":"616480388","full_name":"Hanson/collection","owner":"Hanson","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-28T08:54:42.000Z","size":17,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T04:15:18.401Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/Hanson.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":"2023-03-20T13:24:06.000Z","updated_at":"2024-08-28T08:54:46.000Z","dependencies_parsed_at":"2025-04-14T04:15:21.986Z","dependency_job_id":"c1991328-12e5-43c6-809d-8c7181f438a5","html_url":"https://github.com/Hanson/collection","commit_stats":null,"previous_names":["hanson/collection"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Hanson/collection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcollection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcollection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcollection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcollection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hanson","download_url":"https://codeload.github.com/Hanson/collection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcollection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28681009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T04:33:33.518Z","status":"ssl_error","status_checked_at":"2026-01-23T04:33:30.433Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-15T06:32:42.254Z","updated_at":"2026-01-23T05:36:57.126Z","avatar_url":"https://github.com/Hanson.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# collection\n\nComing soon ...\n\n## Support function\n\n* [KeyBy](#KeyBy)\n* [KeyBySlice](#KeyBySlice)\n* [PluckUint64](#PluckUint64)\n* [PluckString](#PluckString)\n\n## Usage\n\n### KeyBy\n\n```\ntype Person struct {\n\tName string\n\tAge  int\n}\npeople := []*Person{\n\t{Name: \"Alice\", Age: 25},\n\t{Name: \"Bob\", Age: 30},\n\t{Name: \"Charlie\", Age: 35},\n}\nresult := KeyBy(people, \"Name\").(map[string]*Person)\n\nresult[\"Alice\"].Age // 25\n```\n\n### KeyBySlice\n\n```\ntype Person struct {\n\tName string\n\tId   int\n}\npeople := []*Person{\n\t{\n\t\tName: \"Alice\",\n\t\tId:   1,\n\t},\n\t{\n\t\tName: \"Bill\",\n\t\tId:   1,\n\t},\n\t{\n\t\tName: \"Bill\",\n\t\tId:   3,\n\t},\n}\n\nresult := KeyBySlice(people, \"Id\").(map[int][]*Person)\nresult[1] // [0xc000008120 0xc000008138]\nresult[1][0] // \u0026{Alice 1}\n```\n\n### PluckUint64\n\n```\ntype testStruct struct {\n\tID   uint64\n\tName string\n}\n\ntests := []*testStruct{\n\t{ID: 1, Name: \"Alice\"},\n\t{ID: 2, Name: \"Bob\"},\n\t{ID: 3, Name: \"Charlie\"},\n}\n\nresult := PluckUint64(tests, \"ID\")\n// result: []uint64{1, 2, 3}\n```\n\n## Respect\n\nhttps://laravel.com/docs/10.x/collections\nhttps://github.com/elliotchance/pie (Most of the code is copied from here.)\n\n## License\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanson%2Fcollection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanson%2Fcollection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanson%2Fcollection/lists"}