pipeline

codecov

Functions

func AggregatorFunc

func AggregatorFunc[Input, Output any](ctx context.Context, input <-chan Input, count int, f func(ctx context.Context, input ...Input) Output) <-chan Output

AggregatorFunc uses the given function to aggregate n Inputs to one Output.

func Bridge

func Bridge[Input any](ctx context.Context, inputsStream <-chan <-chan Input) <-chan Input

Bridge takes a channel of input channels and combines their elements into a single output channel.

func Buffer

func Buffer[Input any](ctx context.Context, input <-chan Input, count int) <-chan Input

Buffer converts a given channel into a buffered channel.

func DecomposerFunc

func DecomposerFunc[Input, Output any](ctx context.Context, input <-chan Input, f func(input Input) []Output) <-chan Output

DecomposerFunc uses the given function to decompose each input from a channel of generic Inputs to a channel of generic Outputs.

func FilterFunc

func FilterFunc[Input any](ctx context.Context, input <-chan Input, f func(ctx context.Context, input Input) bool) (_, _ <-chan Input)

FilterFunc takes a context, input channel, and a filter function that accepts an input and returns a boolean. It returns two channels. One that blocks with the inputs that pass the filter, and one doesn’t block with the inputs that do not pass the filter.

func Merge

func Merge[Input any](ctx context.Context, inputChannels ...<-chan Input) <-chan Input

Merge merges the input channels into a single output channel.

func OrDone

func OrDone[Input any](done <-chan struct{}, inputs <-chan Input) <-chan Input

OrDone wraps a channel with a done channel and returns a forwarding channel that closes when either the original channel or the done channel closes.

func RepeatFunc

func RepeatFunc[Output any](ctx context.Context, fn func() Output) <-chan Output

func SinkFunc

func SinkFunc[Input any](ctx context.Context, inputs <-chan Input, f func(ctx context.Context, input Input))

SinkFunc executes a function on each item in a channel until the channel is closed or the context is cancelled.

func Take

func Take[Input any](ctx context.Context, input <-chan Input, count int) <-chan Input

Take returns a channel that closes after receiving the specified number of elements from the specified input channel.

func Tee

func Tee[Input any](ctx context.Context, input <-chan Input) (_, _ <-chan Input)

Tee splits the input channel into two output channels, and blocks reading the next input until both output channels receive each element.

func ToSlice

func ToSlice[Input any](ctx context.Context, input <-chan Input, count int) []Input

ToSlice converts the specified number of elements from the specified input channel into a slice.

func TransformerFunc

func TransformerFunc[Input, Output any](ctx context.Context, input <-chan Input, f func(ctx context.Context, input Input) Output) <-chan Output

TransformerFunc uses the given function to transform a channel of generic Inputs to a channel of generic Outputs.


GitHub

View Github