{"id":31532697,"url":"https://github.com/floatdrop/batchan","last_synced_at":"2025-10-04T03:57:58.950Z","repository":{"id":300788117,"uuid":"1006968685","full_name":"floatdrop/batchan","owner":"floatdrop","description":"Channel batching","archived":false,"fork":false,"pushed_at":"2025-06-23T15:58:32.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-23T16:41:56.392Z","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/floatdrop.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":"2025-06-23T09:09:06.000Z","updated_at":"2025-06-23T15:58:02.000Z","dependencies_parsed_at":"2025-06-23T16:52:02.639Z","dependency_job_id":null,"html_url":"https://github.com/floatdrop/batchan","commit_stats":null,"previous_names":["floatdrop/batchan"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/floatdrop/batchan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fbatchan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fbatchan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fbatchan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fbatchan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floatdrop","download_url":"https://codeload.github.com/floatdrop/batchan/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fbatchan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278262443,"owners_count":25957938,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-10-04T03:57:52.358Z","updated_at":"2025-10-04T03:57:58.941Z","avatar_url":"https://github.com/floatdrop.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BatChan\n\n[![CI](https://github.com/floatdrop/batchan/actions/workflows/ci.yaml/badge.svg)](https://github.com/floatdrop/batchan/actions/workflows/ci.yaml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/floatdrop/batchan)](https://goreportcard.com/report/github.com/floatdrop/batchan)\n[![Go Reference](https://pkg.go.dev/badge/github.com/floatdrop/batchan.svg)](https://pkg.go.dev/github.com/floatdrop/batchan)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA lightweight Go library for batching values from a channel with support for size-based and optional timeout-based flushing.\n\n## Features\n\n- Batch items from a channel based on size\n- Flush batches after a timeout, even if not full\n- Supports context cancellation with `WithContext` option\n- Zero-dependency, idiomatic Go\n\n## Installation\n\n```bash\ngo get github.com/floatdrop/batchan\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/floatdrop/batchan\"\n)\n\nfunc main() {\n\tinput := make(chan string, 5)\n\tbatches := batchan.New(input, 3)\n\n\tgo func() {\n\t\tinputs := []string{\"A\", \"B\", \"C\", \"D\", \"E\"}\n\t\tfor _, v := range inputs {\n\t\t\tinput \u003c- v\n\t\t}\n\t\tclose(input)\n\t}()\n\n\tfor v := range batches {\n\t\tfmt.Println(\"Got:\", v)\n\t}\n\n\t// Output:\n\t// Got: [A B C]\n\t// Got: [D E]\n}\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2Fbatchan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloatdrop%2Fbatchan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2Fbatchan/lists"}