Skip to main content Link Search Menu Expand Document (external link)

FlatMap

func FlatMap[T any, R any](input *Channel[T], mapper func(T) *Channel[R], opts ...options.FlatMapOption) *Channel[R]

FlatMap transforms every input value into a Channel and for each of those, it sends all values to the output channel.

Example

output := FlatMap(input, func(i int) *Channel[int] { return FromSlice([]int{i, i * 10}) })