util

package
v17.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineChannels

func CombineChannels[T any](channels []<-chan T) <-chan T

CombineChannels take a slice of non-nil channels as input and returns a chan that relays the values received across all the input channels. The values transmitted by the returned channel may be received out of order if they are transmitted by different input channels but will retain the order if they are transmitted by the same input channel. The returned channel is closed automatically after the last channel in the input channel list is closed

func RunWithAsyncResult

func RunWithAsyncResult[T any](fn func(ch chan<- T)) <-chan T

RunWithAsyncResult runs the passed function asynchronously and returns the results in a channel. The function may choose to publish as many values using the write-only channel in the callback. The write-only channel is closed automatically after the callback function finishes execution. The channel returned by the function is closed automatically after the last value has been read from the channel

func ToAsync

func ToAsync[T any](value T) <-chan T

ToAsync takes any value and makes it available in a read-only channel. The channel is closed automatically after the value has been read from the channel

Types

This section is empty.

Jump to

Keyboard shortcuts

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