initial commit

This commit is contained in:
2025-01-15 12:31:59 +01:00
commit 9bc35d2089
20 changed files with 845 additions and 0 deletions

11
forward.go Normal file
View File

@ -0,0 +1,11 @@
package channel
// Forward reads all values from all sources and sends them to target.
// It blocks until all values are forwarded and the out channel was closed.
// Use with go keyword for non-blocking behavior
func Forward[T any](target chan<- T, sources ...<-chan T) {
for value := range Merge(sources...) {
target <- value
}
close(target)
}