MCPcopy Create free account
hub / github.com/eapache/channels / Tee

Function Tee

channels.go:180–185  ·  view source on GitHub ↗

Tee (like its Unix namesake) takes a single input channel and an arbitrary number of output channels and duplicates each input into every output. When the input channel is closed, all outputs channels are closed. Tee with a single output channel is equivalent to Pipe (though slightly less efficient)

(input SimpleOutChannel, outputs ...SimpleInChannel)

Source from the content-addressed store, hash-verified

178// and duplicates each input into every output. When the input channel is closed, all outputs channels are closed.
179// Tee with a single output channel is equivalent to Pipe (though slightly less efficient).
180func Tee(input SimpleOutChannel, outputs ...SimpleInChannel) {
181 if len(outputs) == 0 {
182 panic("channels: Tee requires at least one output")
183 }
184 go tee(input, outputs, true)
185}
186
187// Distribute takes a single input channel and an arbitrary number of output channels and duplicates each input
188// into *one* available output. If multiple outputs are waiting for a value, one is chosen at random. When the

Callers

nothing calls this directly

Calls 1

teeFunction · 0.85

Tested by

no test coverage detected