batch

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch[T any] struct {
	// contains filtered or unexported fields
}

Batch struct

func New

func New[T any](size int, flushfunc func(ctx context.Context, items []T)) *Batch[T]

New creates new batch object

func (*Batch[T]) Add

func (b *Batch[T]) Add(ctx context.Context, item T)

Add items from channel to batch and automatically flush them

func (*Batch[T]) Flush

func (b *Batch[T]) Flush(ctx context.Context)

Flush / store batch

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL