chanutil

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package chanutil implements methods for working with channels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Batch

func Batch[T any](in <-chan T, options ...BatchOption) <-chan []T

Batch returns a new channel that consumes all the items from `in` and batches them together.

func Merge

func Merge[T any](ins ...<-chan T) <-chan T

Merge merges multiple channels together.

Types

type BatchOption

type BatchOption func(cfg *batchConfig)

A BatchOption customizes a batch operation.

func WithBatchMaxSize

func WithBatchMaxSize(maxSize int) BatchOption

WithBatchMaxSize sets the maximum batch size for a Batch operation.

func WithBatchMaxWait

func WithBatchMaxWait(maxWait time.Duration) BatchOption

WithBatchMaxWait sets the maximum wait duration for a Batch operation.

Jump to

Keyboard shortcuts

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