pipe

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MulanPSL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithPipeCount

func WithPipeCount(count int) optionFunc

设置数量

Types

type CommonFunc

type CommonFunc func(item interface{}) interface{}

这个是消费函数

type CommonFuncV1

type CommonFuncV1 func(args ...interface{}) interface{}

type ConsumerFuncV1

type ConsumerFuncV1 func(in InChanV1) OutChanV1

type InChan

type InChan chan interface{}

生产者,消费者模式消费 1. 生产者 2. 消费者 3. 两个chan,输入chan和输出chan

type InChanV1

type InChanV1 chan interface{}

生产者,消费者模式消费 1. 生产者 2. 消费者 3. 两个chan,输入chan和输出chan

type OutChan

type OutChan chan interface{}

type OutChanV1

type OutChanV1 chan interface{}

type Pipe

type Pipe struct {
	InChan   InChan
	Producer ProducerFunc
	Count    int //多少个消费者
}

func NewPipe

func NewPipe() *Pipe

func (*Pipe) PipeDo

func (this *Pipe) PipeDo(p ProducerFunc, c CommonFunc, options ...optionFunc) OutChan

type PipeLineCommonChan

type PipeLineCommonChan chan interface{}

流水线

func PipeLineDo

func PipeLineDo(producer PipeLineProducer, userFns ...PipeLineFuncWorker) PipeLineCommonChan

流水线入口 todo 每一个处理步骤可以设置处理的worker数量

type PipeLineFuncWorker

type PipeLineFuncWorker func(chanItem interface{}) interface{}

return nil表示这个数据不再进行处理

type PipeLineProducer

type PipeLineProducer func(dataSourceChan PipeLineCommonChan)

生产者,生产数据

type PipeV1

type PipeV1 struct {
	Producer ProducerFuncV1
	Consumer ConsumerFuncV1
	Count    int //多少个消费者
}

func NewPipeV1

func NewPipeV1() *PipeV1

func (*PipeV1) Excute

func (this *PipeV1) Excute(args ...interface{}) OutChanV1

func (*PipeV1) SetConsumer

func (this *PipeV1) SetConsumer(c ConsumerFuncV1, count int)

func (*PipeV1) SetProducer

func (this *PipeV1) SetProducer(p ProducerFuncV1)

func (*PipeV1) SetProducerNew

func (this *PipeV1) SetProducerNew(p CommonFuncV1) interface{}

type ProducerFunc

type ProducerFunc func(in InChan)

type ProducerFuncV1

type ProducerFuncV1 func(args ...interface{}) InChanV1

Jump to

Keyboard shortcuts

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