result

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2018 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResultChan

func ResultChan(inp ...Result) (out <-chan Result)

ResultChan returns a channel to receive all inputs before close.

func ResultChanFuncErr

func ResultChanFuncErr(gen func() (Result, error)) (out <-chan Result)

ResultChanFuncErr returns a channel to receive all results of generator `gen` until `err != nil` before close.

func ResultChanFuncNok

func ResultChanFuncNok(gen func() (Result, bool)) (out <-chan Result)

ResultChanFuncNok returns a channel to receive all results of generator `gen` until `!ok` before close.

func ResultChanSlice

func ResultChanSlice(inp ...[]Result) (out <-chan Result)

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

func ResultDoneFunc(inp <-chan Result, act func(a Result)) (done <-chan struct{})

ResultDoneFunc will apply `act` to every `inp` and returns a channel to receive one signal upon close.

func ResultDoneSlice

func ResultDoneSlice(inp <-chan Result) (done <-chan []Result)

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

func ResultFanIn2(inp1, inp2 <-chan Result) (out <-chan Result)

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

func ResultFiniFunc(act func(a Result)) func(inp <-chan Result) (done <-chan struct{})

ResultFiniFunc returns a closure around `ResultDoneFunc(_, act)`.

func ResultFiniSlice

func ResultFiniSlice() func(inp <-chan Result) (done <-chan []Result)

ResultFiniSlice returns a closure around `ResultDoneSlice(_)`.

func ResultFork

func ResultFork(inp <-chan Result) (out1, out2 <-chan Result)

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

func ResultPair(inp <-chan Result) (out1, out2 <-chan Result)

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

func ResultPipeFunc(inp <-chan Result, act func(a Result) Result) (out <-chan Result)

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.

func ResultTubeFunc

func ResultTubeFunc(act func(a Result) Result) (tube func(inp <-chan Result) (out <-chan Result))

ResultTubeFunc returns a closure around PipeResultFunc (_, act).

Types

type Result

type Result string

Result represents (a secondary) observation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL