{"id":13413091,"url":"https://github.com/rafaeljesus/parallel-fn","last_synced_at":"2025-04-27T20:32:48.753Z","repository":{"id":57496851,"uuid":"94678405","full_name":"rafaeljesus/parallel-fn","owner":"rafaeljesus","description":"Run functions in parallel :comet:","archived":false,"fork":false,"pushed_at":"2018-01-01T20:34:49.000Z","size":11,"stargazers_count":36,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-31T20:51:54.268Z","etag":null,"topics":["concurrency","go","goroutines"],"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/rafaeljesus.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}},"created_at":"2017-06-18T09:47:54.000Z","updated_at":"2024-07-09T09:50:08.000Z","dependencies_parsed_at":"2022-09-03T02:30:52.981Z","dependency_job_id":null,"html_url":"https://github.com/rafaeljesus/parallel-fn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaeljesus%2Fparallel-fn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaeljesus%2Fparallel-fn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaeljesus%2Fparallel-fn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaeljesus%2Fparallel-fn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rafaeljesus","download_url":"https://codeload.github.com/rafaeljesus/parallel-fn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251204648,"owners_count":21552259,"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":["concurrency","go","goroutines"],"created_at":"2024-07-30T20:01:33.350Z","updated_at":"2025-04-27T20:32:48.465Z","avatar_url":"https://github.com/rafaeljesus.png","language":"Go","funding_links":[],"categories":["Goroutines","Go","Relational Databases"],"sub_categories":["Advanced Console UIs","Search and Analytic Databases","检索及分析资料库","SQL 查询语句构建库"],"readme":"## Parallel fn\n\n* Run functions in parallel.\n* Limit the number of goroutines running at the same time.\n\n## Installation\n```bash\ngo get -u github.com/rafaeljesus/parallel-fn\n```\n\n## Usage\n### Run\n```go\npackage main\n\nimport (\n  \t\"errors\"\n\n  \t\"github.com/rafaeljesus/parallel-fn\"\n)\n\nfunc main() {\n\ttimeout := time.After(2 * time.Second)\n        fn1 := func() error { return nil }\n        fn2 := func() error { return errors.New(\"BOOM!\") }\n\n\tfor {\n\t\tselect {\n\t\tcase err := \u003c-Run(fn1, fn2):\n                \t// catch errors\n\t\tcase \u003c-timeout:\n      \t\t\t// handle timeout\n\t\t}\n\t}\n}\n```\n\n### RunLimit\n```go\npackage main\n\nimport (\n  \t\"errors\"\n\n  \t\"github.com/rafaeljesus/parallel-fn\"\n)\n\nfunc main() {\n\ttimeout := time.After(2 * time.Second)\n  \tfn1 := func() error { return nil }\n  \tfn2 := func() error { return errors.New(\"BOOM!\") }\n  \tfn3 := func() error { nil }\n  \tfn4 := func() error { nil }\n\n\tfor {\n\t\tselect {\n\t\tcase err := \u003c-RunLimit(2, fn1, fn2, fn3, fn4):\n      \t\t\t// catch errors\n\t\tcase \u003c-timeout:\n      \t\t\t// handle timeout\n\t\t}\n\t}\n}\n```\n\n## Contributing\n- Fork it\n- Create your feature branch (`git checkout -b my-new-feature`)\n- Commit your changes (`git commit -am 'Add some feature'`)\n- Push to the branch (`git push origin my-new-feature`)\n- Create new Pull Request\n\n## Badges\n\n[![Build Status](https://circleci.com/gh/rafaeljesus/parallel-fn.svg?style=svg)](https://circleci.com/gh/rafaeljesus/parallel-fn)\n[![Go Report Card](https://goreportcard.com/badge/github.com/rafaeljesus/parallel-fn)](https://goreportcard.com/report/github.com/rafaeljesus/parallel-fn)\n[![Go Doc](https://godoc.org/github.com/rafaeljesus/parallel-fn?status.svg)](https://godoc.org/github.com/rafaeljesus/parallel-fn)\n\n---\n\n\u003e GitHub [@rafaeljesus](https://github.com/rafaeljesus) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e Medium [@_jesus_rafael](https://medium.com/@_jesus_rafael) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e Twitter [@_jesus_rafael](https://twitter.com/_jesus_rafael)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaeljesus%2Fparallel-fn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafaeljesus%2Fparallel-fn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaeljesus%2Fparallel-fn/lists"}