concurrency

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Batch

func Batch[T any](ch <-chan T, size int) <-chan []T

Batch groups input values from a channel into batches of a specified size.

func FanIn

func FanIn[T any](streams ...<-chan T) <-chan T

FanIn merges multiple channels of input values into a single channel of output values.

func FanOut

func FanOut[T any](ch chan T, size int, ordered bool) []<-chan T

FanOut splits a channel of input values into multiple channels of output values in a round-robin fashion.

func Filter added in v1.1.4

func Filter[IN any](fn func(IN) bool) func(<-chan IN) <-chan IN

Filter filtered channel values by applying a function to each input value.

func Parallel

func Parallel[IN, OUT any](stream <-chan IN, fn func(IN) OUT, count int) <-chan OUT

Parallel applies a function to each input value from a channel using a worker pool of a specified size.

func Pipeline

func Pipeline[IN, OUT any](fn func(IN) OUT) func(<-chan IN) <-chan OUT

Pipeline converts a channel of input values to a channel of output values by applying a function to each input value.

func Split

func Split[IN, OUT1, OUT2 any](in <-chan IN, fn func(IN) (OUT1, OUT2)) (<-chan OUT1, <-chan OUT2)

Split splits a channel of input values into two channels of output values by applying a function to each input value.

Types

type Future added in v1.1.4

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

func NewFuture added in v1.1.4

func NewFuture[T any](action func() (T, error)) *Future[T]

func (*Future[T]) Get added in v1.1.4

func (f *Future[T]) Get() (T, error)

Jump to

Keyboard shortcuts

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