High performance, easy to use batcher written in Go with generics™.
go get -u github.com/garugaru/go-batcher
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)
}