Distinct
func Distinct[T any, K comparable](input *Channel[T], getKey func(T) K) *Channel[T]
Distinct
sends only input values for which the key hasn’t been seen before to the output channel. In simple words, it deduplicates the input channel. It uses an internal map to keep track of all keys seen, so keep in mind that it could exhaust memory if too many distinct values are received.
Example
output := Distinct(input, func(value int) int { return value })