{"id":19249082,"url":"https://github.com/rashadansari/go-batch","last_synced_at":"2025-08-08T19:17:43.399Z","repository":{"id":57626573,"uuid":"402094654","full_name":"RashadAnsari/go-batch","owner":"RashadAnsari","description":"A simple batching library in Golang","archived":false,"fork":false,"pushed_at":"2024-10-16T13:49:11.000Z","size":19,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T12:42:53.758Z","etag":null,"topics":["batch","batching","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/RashadAnsari.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":"2021-09-01T14:39:47.000Z","updated_at":"2024-12-03T06:30:40.000Z","dependencies_parsed_at":"2025-04-21T12:45:06.996Z","dependency_job_id":null,"html_url":"https://github.com/RashadAnsari/go-batch","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/RashadAnsari/go-batch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RashadAnsari%2Fgo-batch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RashadAnsari%2Fgo-batch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RashadAnsari%2Fgo-batch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RashadAnsari%2Fgo-batch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RashadAnsari","download_url":"https://codeload.github.com/RashadAnsari/go-batch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RashadAnsari%2Fgo-batch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265121267,"owners_count":23714500,"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":["batch","batching","go","golang"],"created_at":"2024-11-09T18:12:31.951Z","updated_at":"2025-07-22T11:03:43.598Z","avatar_url":"https://github.com/RashadAnsari.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Batch\n\nA simple batching library in Golang.\n\n## Guid\n\n### Installation\n\n```bash\ngo get github.com/RashadAnsari/go-batch/v2\n```\n\n### Example\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"math/rand\"\n\t\"reflect\"\n\t\"time\"\n\n\tgoBatch \"github.com/RashadAnsari/go-batch/v2\"\n)\n\nfunc main() {\n\tctx, canl := context.WithCancel(context.Background())\n\n\tbatch := goBatch.New[int](\n\t\tgoBatch.WithSize(10),\n\t\tgoBatch.WithMaxWait(1*time.Second),\n\t\tgoBatch.WithContext(ctx),\n\t)\n\n\tgo func() {\n\t\tfor {\n\t\t\toutput := \u003c-batch.Output\n\n\t\t\tlog.Printf(\"output: %v, size: %d\\n\",\n\t\t\t\toutput, reflect.ValueOf(output).Len())\n\t\t}\n\t}()\n\n\tfor i := 1; i \u003c= 100; i++ {\n\t\tbatch.Input \u003c- i\n\t}\n\n\ttime.Sleep(1 * time.Second)\n\n\tfor i := 1; i \u003c= 100; i++ {\n\t\tbatch.Input \u003c- i\n\n\t\tif rand.Intn(2) == 0 {\n\t\t\ttime.Sleep(300 * time.Millisecond)\n\t\t}\n\t}\n\n\tcanl()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frashadansari%2Fgo-batch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frashadansari%2Fgo-batch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frashadansari%2Fgo-batch/lists"}