Documentation
¶
Index ¶
- type Data
- type DataCh
- type Pipeline
- func (p *Pipeline) Broadcast(n int) []*Pipeline
- func (p *Pipeline) Buffer(size int) *Pipeline
- func (p *Pipeline) Collect() []any
- func (p *Pipeline) FanOut(n int) []*Pipeline
- func (p *Pipeline) Filter(pred func(any) bool) *Pipeline
- func (p *Pipeline) FlatMap(fn func(any) []any) *Pipeline
- func (p *Pipeline) ForEach(fn func(any))
- func (p *Pipeline) Join(others ...*Pipeline) *Pipeline
- func (p *Pipeline) Parallel(n int, fn func(any) any) *Pipeline
- func (p *Pipeline) Run() <-chan any
- func (p *Pipeline) Skip(n int) *Pipeline
- func (p *Pipeline) Split(pred func(any) bool) (trueBranch, falseBranch *Pipeline)
- func (p *Pipeline) Take(n int) *Pipeline
- func (p *Pipeline) Tap(fn func(any)) *Pipeline
- func (p *Pipeline) Transform(fn func(any) any) *Pipeline
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶ added in v0.63.0
type Data[I, O any] struct { // contains filtered or unexported fields }
type DataCh ¶ added in v0.63.0
type DataCh[I, O any] struct { // contains filtered or unexported fields }
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline 流式管道,any 为当前流经的数据类型
func NewPipeline ¶
func NewPipelineFromSlice ¶
FromSlice 从 slice 创建管道(内部自动推送并关闭)
func (*Pipeline) Parallel ¶
Parallel 并行处理:N 个 worker 同时争抢执行 fn,结果自动合并
N 个 goroutine 同时从输入 channel 争抢读取,执行 fn 后写入输出 channel
func (*Pipeline) Split ¶
Split 按条件分流为两个独立 Pipeline,各自可继续链式构建
trueBranch 走 pred == true 的数据 falseBranch 走 pred == false 的数据
Click to show internal directories.
Click to hide internal directories.