Documentation ¶
Index ¶
- func ResultChan(inp ...Result) (out <-chan Result)
- func ResultChanFuncErr(gen func() (Result, error)) (out <-chan Result)
- func ResultChanFuncNok(gen func() (Result, bool)) (out <-chan Result)
- func ResultChanSlice(inp ...[]Result) (out <-chan Result)
- func ResultDone(inp <-chan Result) (done <-chan struct{})
- func ResultDoneFunc(inp <-chan Result, act func(a Result)) (done <-chan struct{})
- func ResultDoneSlice(inp <-chan Result) (done <-chan []Result)
- func ResultFanIn2(inp1, inp2 <-chan Result) (out <-chan Result)
- func ResultFini() func(inp <-chan Result) (done <-chan struct{})
- func ResultFiniFunc(act func(a Result)) func(inp <-chan Result) (done <-chan struct{})
- func ResultFiniSlice() func(inp <-chan Result) (done <-chan []Result)
- func ResultFork(inp <-chan Result) (out1, out2 <-chan Result)
- func ResultMakeChan() (out chan Result)
- func ResultPair(inp <-chan Result) (out1, out2 <-chan Result)
- func ResultPipeFunc(inp <-chan Result, act func(a Result) Result) (out <-chan Result)
- func ResultTubeFunc(act func(a Result) Result) (tube func(inp <-chan Result) (out <-chan Result))
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResultChan ¶
ResultChan returns a channel to receive all inputs before close.
func ResultChanFuncErr ¶
ResultChanFuncErr returns a channel to receive all results of generator `gen` until `err != nil` before close.
func ResultChanFuncNok ¶
ResultChanFuncNok returns a channel to receive all results of generator `gen` until `!ok` before close.
func ResultChanSlice ¶
ResultChanSlice returns a channel to receive all inputs before close.
func ResultDone ¶
func ResultDone(inp <-chan Result) (done <-chan struct{})
ResultDone returns a channel to receive one signal upon close and after `inp` has been drained.
func ResultDoneFunc ¶
ResultDoneFunc will apply `act` to every `inp` and returns a channel to receive one signal upon close.
func ResultDoneSlice ¶
ResultDoneSlice returns a channel to receive a slice with every Result received on `inp` upon close.
Note: Unlike ResultDone, ResultDoneSlice sends the fully accumulated slice, not just an event, once upon close of inp.
func ResultFanIn2 ¶
ResultFanIn2 returns a channel to receive all from both `inp1` and `inp2` before close.
func ResultFini ¶
func ResultFini() func(inp <-chan Result) (done <-chan struct{})
ResultFini returns a closure around `ResultDone(_)`.
func ResultFiniFunc ¶
ResultFiniFunc returns a closure around `ResultDoneFunc(_, act)`.
func ResultFiniSlice ¶
ResultFiniSlice returns a closure around `ResultDoneSlice(_)`.
func ResultFork ¶
ResultFork returns two channels either of which is to receive every result of inp before close.
func ResultMakeChan ¶
func ResultMakeChan() (out chan Result)
ResultMakeChan returns a new open channel (simply a 'chan Result' that is). Note: No 'Result-producer' is launched here yet! (as is in all the other functions).
This is useful to easily create corresponding variables such as:
var myResultPipelineStartsHere := ResultMakeChan() // ... lot's of code to design and build Your favourite "myResultWorkflowPipeline"
// ... // ... *before* You start pouring data into it, e.g. simply via: for drop := range water {
myResultPipelineStartsHere <- drop
}
close(myResultPipelineStartsHere)
Hint: especially helpful, if Your piping library operates on some hidden (non-exported) type (or on a type imported from elsewhere - and You don't want/need or should(!) have to care.)
Note: as always (except for ResultPipeBuffer) the channel is unbuffered.
func ResultPair ¶
ResultPair returns a pair of channels to receive every result of inp before close.
Note: Yes, it is a VERY simple fanout - but sometimes all You need.
func ResultPipeFunc ¶
ResultPipeFunc returns a channel to receive every result of action `act` applied to `inp` before close. Note: it 'could' be ResultPipeMap for functional people, but 'map' has a very different meaning in go lang.