{"id":37106595,"url":"https://github.com/rakeeb-hossain/functools","last_synced_at":"2026-01-14T12:50:23.639Z","repository":{"id":45349447,"uuid":"438780376","full_name":"rakeeb-hossain/functools","owner":"rakeeb-hossain","description":"Functional tools in Go 1.18 using newly introduced generics","archived":false,"fork":false,"pushed_at":"2022-09-23T02:31:00.000Z","size":53,"stargazers_count":176,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-06-18T23:12:44.630Z","etag":null,"topics":["functional","generics","go","golang"],"latest_commit_sha":null,"homepage":"","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/rakeeb-hossain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-15T21:39:00.000Z","updated_at":"2024-05-07T08:29:09.000Z","dependencies_parsed_at":"2022-09-02T02:12:05.692Z","dependency_job_id":null,"html_url":"https://github.com/rakeeb-hossain/functools","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rakeeb-hossain/functools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakeeb-hossain%2Ffunctools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakeeb-hossain%2Ffunctools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakeeb-hossain%2Ffunctools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakeeb-hossain%2Ffunctools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rakeeb-hossain","download_url":"https://codeload.github.com/rakeeb-hossain/functools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakeeb-hossain%2Ffunctools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["functional","generics","go","golang"],"created_at":"2026-01-14T12:50:22.814Z","updated_at":"2026-01-14T12:50:23.625Z","avatar_url":"https://github.com/rakeeb-hossain.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# functools\n\n[![Go](https://github.com/rakeeb-hossain/functools/actions/workflows/go.yml/badge.svg)](https://github.com/rakeeb-hossain/functools/actions/workflows/go.yml)\n\nfunctools is a simple Go library that brings you your favourite functional paradigms without sacrificing type-safety using \n`interface{}` or `reflect`\n\nMade possible by Go 1.18 using the newly introduced generics.\n\n## Features\n \n- Any\n- All\n- Count\n- Filter\n- ForEach\n- Map\n- Reduce\n- ReduceRight\n- Sum\n- Chunk\n\n## Installation\n\n`go get -u github.com/rakeeb-hossain/functools`\n\n## Usage\n\n```go\nimport (\n    \"github.com/rakeeb-hossain/functools\"\n    \"fmt\"\n)\n\ntype User struct {\n\tusername     string\n\thasPortfolio bool\n}\n\nvar users = []User{\n\t\t{\"gopher\", true},\n\t\t{\"rakeeb\", false},\n\t\t{\"jack\", true}}\n\nfunc main() {\n    // Count users with linked portfolios\n    fmt.Printf(\"num users with linked portfolios: %d\", \n        functools.Count(users, func(u User) bool { return u.hasPortfolio }))\n\n    // Print usernames of users with linked portfolios\n    functools.ForEach(\n        functools.Filter(users, func(u User) bool { return u.hasPortfolio }),\n        func(u User) { fmt.Printf(\"%s has a linked portfolio\\n\", u.username) })\n}\n```\n\n## Documentation\n\nhttps://pkg.go.dev does not yet support Go 1.18 packages that use generics: https://github.com/golang/go/issues/48264\n\nFor now, documentation is provided via comments and by running `go doc -all` from the package directory. \n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakeeb-hossain%2Ffunctools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frakeeb-hossain%2Ffunctools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakeeb-hossain%2Ffunctools/lists"}