added generic types + FilterChanges
This commit is contained in:
18
types.go
Normal file
18
types.go
Normal file
@ -0,0 +1,18 @@
|
||||
package channel
|
||||
|
||||
func DefaultEqualityComparator[T comparable](a, b T) bool {
|
||||
return a == b
|
||||
}
|
||||
|
||||
type EqualityComparator[T any] = func(a, b T) bool
|
||||
type FilterFunc[T any] = func(T) bool
|
||||
type Consumer[T any] = func(T)
|
||||
type IndexedConsumer[T any] = func(int, T)
|
||||
|
||||
type Mapper[I, O any] = func(I) O
|
||||
type ErrorMapper[I, O any] = func(I) (O, error)
|
||||
|
||||
type MapMapper[T any, K comparable, V any] = func(T) (K, V)
|
||||
type MapUnmapper[K comparable, V, T any] = func(K, V) T
|
||||
|
||||
type Reducer[A, T any] = func(acc A, value T) A
|
Reference in New Issue
Block a user