tstor/src/delivery/graphql/resolver/utils.go
2024-12-17 01:04:44 +03:00

15 lines
249 B
Go

package resolver
import "iter"
func Filter1Func[K, V any](S iter.Seq2[K, V], match func(V) bool) iter.Seq2[K, V] {
return func(yield func(K, V) bool) {
for k, v := range S {
if match(v) {
if !yield(k, v) {
break
}
}
}
}
}