added generic types + FilterChanges

This commit is contained in:
2025-06-26 15:22:42 +02:00
parent 21430b0d65
commit 9990d7206d
7 changed files with 48 additions and 20 deletions

4
of.go
View File

@ -56,7 +56,7 @@ func OfFunc[T any](ctx context.Context, buffer int, f func() T) <-chan T {
// OfMap returns a channel containing the return values of the unmapper function
// applied to any key-value pair in m
// The order is random
func OfMap[K comparable, V, T any](m map[K]V, unmapper func(K, V) T) <-chan T {
func OfMap[K comparable, V, T any](m map[K]V, unmapper MapUnmapper[K, V, T]) <-chan T {
out := make(chan T, len(m))
go func() {
@ -85,7 +85,7 @@ func OfSeq[T any](seq iter.Seq[T], buffer int) <-chan T {
// OfSeq2 returns a channel containing the return values of the unmapper function
// when provided with the values of the iterator
func OfSeq2[K comparable, V, T any](seq iter.Seq2[K, V], buffer int, unmapper func(K, V) T) <-chan T {
func OfSeq2[K comparable, V, T any](seq iter.Seq2[K, V], buffer int, unmapper MapUnmapper[K, V, T]) <-chan T {
out := make(chan T, buffer)
go func() {