{"id":21638568,"url":"https://github.com/bongnv/task","last_synced_at":"2025-10-25T17:20:26.182Z","repository":{"id":51125335,"uuid":"369528778","full_name":"bongnv/task","owner":"bongnv","description":"task is a simple Go library that helps to compose a complex business logic from smaller pieces in a maintainable way.","archived":false,"fork":false,"pushed_at":"2021-05-22T12:49:01.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T02:44:59.304Z","etag":null,"topics":[],"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/bongnv.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":"2021-05-21T12:30:13.000Z","updated_at":"2021-05-22T12:48:03.000Z","dependencies_parsed_at":"2022-08-27T22:42:00.103Z","dependency_job_id":null,"html_url":"https://github.com/bongnv/task","commit_stats":null,"previous_names":["bongnv/job"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bongnv%2Ftask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bongnv%2Ftask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bongnv%2Ftask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bongnv%2Ftask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bongnv","download_url":"https://codeload.github.com/bongnv/task/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244333022,"owners_count":20436123,"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":[],"created_at":"2024-11-25T04:10:24.533Z","updated_at":"2025-10-25T17:20:21.137Z","avatar_url":"https://github.com/bongnv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# task\n\n[![CI](https://github.com/bongnv/task/actions/workflows/ci.yml/badge.svg)](https://github.com/bongnv/task/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/bongnv/task/branch/main/graph/badge.svg?token=OpOoecFx9h)](https://codecov.io/gh/bongnv/task)\n[![Go Report Card](https://goreportcard.com/badge/github.com/bongnv/task)](https://goreportcard.com/report/github.com/bongnv/task)\n\n`task` is a simple library that helps to compose complex business logic from smaller steps in a maintainable way.\n\n## Quick Start\n\n1. Make sure [Go](https://golang.org/) is installed and import `task` package to your project via the below command:\n```sh\n$ go get -u github.com/bongnv/task\n```\n\n2. Import it to your code:\n\n```go\nimport \"github.com/bongnv/task\"\n```\n\n3. Use `task.Exec` to run multiple tasks in sequence:\n\n```go\n\tstep1 := makeTask(\"Rinse the rice\")\n\tstep2 := makeTask(\"Use the right ratio of water\")\n\tstep3 := makeTask(\"Bring the water to a boil\")\n\tstep4 := makeTask(\"Maintain a simmer\")\n\tstep5 := makeTask(\"Cook without peeking or stirring\")\n\tstep6 := makeTask(\"Let the rice rest covered\")\n\n\terr := task.Exec(\n\t\tctx,\n\t\tstep1,\n\t\tstep2,\n\t\tstep3,\n\t\tstep4,\n\t\tstep5,\n\t\tstep6,\n\t)\n```\n\n## Usages\n\nThere are two ways to compose tasks together:\n\n1. `task.Sequence` creates a new task by running multiple tasks in a sequence. It stops and returns error if any task returns error.\n\n```go\n\tcomposedTask := task.Sequence(\n\t\tstep1,\n\t\tstep2,\n\t\tstep3,\n\t)\n```\n2. `task.Concurence` creates a new task by running multiple tasks concurrently. It stops, cancels the provided context and returns error if any task return error.\n\n```go\n\tcomposedTask := task.Concurrence(\n\t\tstep1,\n\t\tstep2,\n\t\tstep3,\n\t)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbongnv%2Ftask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbongnv%2Ftask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbongnv%2Ftask/lists"}