Documentation
¶
Index ¶
- Variables
- func ChannelToSlice[T any](c <-chan T) []T
- func ChannelToSliceWithContext[T any](ctx context.Context, c <-chan T) []T
- func CopyChannelWithContext[T any](ctx context.Context, c <-chan T) (a, b <-chan T)
- func MergeChannels[T any](bufferSize int, channels ...<-chan T) <-chan T
- func MergeChannelsWithContext[T any](ctx context.Context, bufferSize int, channels ...<-chan T) <-chan T
- func ProcessChannelThroughFunction[T any](ctx context.Context, c <-chan T, workCallback ChannelPipelineWorkFunction[T]) <-chan T
- func SliceToChannel[T any](s []T, bufferSize int) <-chan T
- func SliceToChannelWithContext[T any](ctx context.Context, s []T, bufferSize int) <-chan T
- func TryAddToChannel[T any](ctx context.Context, c chan<- T, t T) error
- func TrySelectFromChannel[T any](ctx context.Context, c <-chan T) (T, error)
- type ChannelPipelineWorkFunction
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrChannelClosed = errors.New("channel is closed (returned !ok)")
)
Functions ¶
func ChannelToSlice ¶
func ChannelToSlice[T any](c <-chan T) []T
func CopyChannelWithContext ¶
func MergeChannels ¶
func MergeChannelsWithContext ¶
func MergeChannelsWithContext[T any](ctx context.Context, bufferSize int, channels ...<-chan T) <-chan T
could be problematic in certain situations because it launches one goroutine per incoming channel. this shouldn't typically be a problem with a small number of channels, or when the channels producers aren't very busy, but it's worth noting.
func ProcessChannelThroughFunction ¶
func ProcessChannelThroughFunction[T any](ctx context.Context, c <-chan T, workCallback ChannelPipelineWorkFunction[T]) <-chan T
func SliceToChannel ¶
Types ¶
type ChannelPipelineWorkFunction ¶
type ChannelPipelineWorkFunction[T any] func(T) T
Click to show internal directories.
Click to hide internal directories.