Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscardCh ¶
func DiscardCh[T any](ch <-chan T)
DiscardCh consumes all incoming messages from the given channel until it's closed.
func Filter ¶
Filter takes a slice of type []T and a Matcher[T]. It returns a newly allocated slice containing only those elements of the input slice that satisfy the matcher.
func Map ¶
Map applies the Mapper function to each element of the slice and returns a new slice with the results in the same order.
func Reduce ¶
Reduce applies the Reducer function to all elements of the input values and returns the result.
func Uniq ¶ added in v1.0.0
func Uniq[T comparable](in []T) []T
Uniq return a copy of the input array with all duplicates removed
Types ¶
type Future ¶
type Future[T any] interface { Send(T) Await() T }
Future is an object that holds a result value. The value may be read and written asynchronously.
type Mapper ¶
type Mapper[T, U any] func(T) U
Mapper is a function that converts a value of one type to another type.
type Matcher ¶
Matcher is a function that tests if a given value match a certain criteria.
func Equals ¶
func Equals[T comparable](value T) Matcher[T]
Equals return a Matcher that matches the given value
func NotEquals ¶
func NotEquals[T comparable](value T) Matcher[T]
NotEquals return a Matcher that does not match the given value