channels

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEach

func ForEach[T any](ctx context.Context, in <-chan T, do func(T) error) error

ForEach passes each message received from a channel to a function.

It blocks until the given context is closed or the function returns an error.

func Forward

func Forward[T any](ctx context.Context, from <-chan T, to chan<- T) error

Forward sends messages received from one channel to another.

It blocks until the given context is closed.

func NilOrCanceled

func NilOrCanceled(err error) bool

NilOrCanceled returns true IFF an error is either nil or wraps context.Canceled.

func Send

func Send[T any](ctx context.Context, to chan<- T, msgs ...T) error

Send sends a slice of messages to a channel.

It blocks until every message is sent or the given context is closed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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