Versions in this module Expand all Collapse all v1 v1.2.9 Mar 13, 2026 Changes in this version + type Buffer struct + func NewBuffer[T any](cfg Config[T]) (*Buffer[T], error) + func (b *Buffer[T]) Add(ctx context.Context, item T) error + func (b *Buffer[T]) Close() + func (b *Buffer[T]) ItemsInChannel() int + func (b *Buffer[T]) Run(ctx context.Context) error + type Config struct + CanAdd func(batch []T, item T) bool + Capacity int + ChanSize int + Flush FlushFunc[T] + FlushInterval time.Duration + OnFlushError func(err error, batch []T) + OnReject func(item T) + ShouldFlush func(batch []T) bool + WillOverflow func(batch []T, item T) bool + type FlushFunc func(ctx context.Context, batch []T) error