Documentation ¶
Overview ¶
Package concurrency contain some functions to support concurrent programming. eg, goroutine, channel, async.
Index ¶
- type Channel
- func (c *Channel) Bridge(ctx context.Context, chanStream <-chan <-chan any) <-chan any
- func (c *Channel) FanIn(ctx context.Context, channels ...<-chan any) <-chan any
- func (c *Channel) Generate(ctx context.Context, values ...any) <-chan any
- func (c *Channel) Or(channels ...<-chan any) <-chan any
- func (c *Channel) OrDone(ctx context.Context, channel <-chan any) <-chan any
- func (c *Channel) Repeat(ctx context.Context, values ...any) <-chan any
- func (c *Channel) RepeatFn(ctx context.Context, fn func() any) <-chan any
- func (c *Channel) Take(ctx context.Context, valueStream <-chan any, number int) <-chan any
- func (c *Channel) Tee(ctx context.Context, in <-chan any) (<-chan any, <-chan any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { }
Channel is a logic object which can generate or manipulate go channel all methods of Channel are in the book tilted《Concurrency in Go》
func (*Channel) Or ¶
Or read one or more channels into one channel, will close when any readin channel is closed
func (*Channel) OrDone ¶
OrDone read a channel into another channel, will close until cancel context.
func (*Channel) Repeat ¶
Repeat return a data of type any chan, put param `values` into the chan repeatly until cancel the context.
func (*Channel) RepeatFn ¶
RepeatFn return a chan, excutes fn repeatly, and put the result into retruned chan until close the `done` channel