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

All

func (input *Channel[T]) All(predicate func(T) bool) <-chan bool

All determines if all input values match the predicate.

If all values match the predicate, true is sent to the returned channel when all input values have been processed, or the pipeline is canceled.

If instead some value does not match the predicate, false is immediately sent to the returned channel and no more input values are read.

Examples

output := input.All(func(value int) bool { return value < 4 })

output := input.All(func(value int) bool { return value < 2 })