https://github.com/garugaru/go-batcher
High performance, easy to use batcher written in Go with generics™
https://github.com/garugaru/go-batcher
batch-processing batcher generics-in-golang golang golang-library
Last synced: 8 months ago
JSON representation
High performance, easy to use batcher written in Go with generics™
- Host: GitHub
- URL: https://github.com/garugaru/go-batcher
- Owner: GaruGaru
- Created: 2022-10-01T11:23:24.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T16:42:17.000Z (over 3 years ago)
- Last Synced: 2025-03-24T15:13:56.147Z (about 1 year ago)
- Topics: batch-processing, batcher, generics-in-golang, golang, golang-library
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-batcher [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
High performance, easy to use batcher written in Go with generics™.
## Installation
`go get -u github.com/garugaru/go-batcher`
## Quick Start
```go
batch := batcher.NewBatcher[string](
batcher.Emit[string](
batcher.Every(100*time.Millisecond),
),
batcher.Process(func(items []string) error {
fmt.Println(strings.Join(items, ","))
return nil
}),
)
batch.Start(context.Background())
batch.Accumulate("hello", "world", "!")
if err := batch.Wait(); err != nil {
panic(err)
}
```
[ci-img]: https://github.com/garugaru/go-batcher/actions/workflows/tests.yml/badge.svg
[cov-img]: https://codecov.io/gh/garugaru/go-batcher/branch/master/graph/badge.svg
[ci]: https://github.com/garugaru/go-batcher/actions/workflows/tests.yml
[cov]: https://codecov.io/gh/garugaru/go-batcher