Documentation ¶
Index ¶
- func DoStream(outlet streams.Outlet, inlet streams.Inlet)
- func FanOut(outlet streams.Outlet, magnitude int) []streams.Flow
- func Flatten(parallelism uint) streams.Flow
- func Merge(outlets ...streams.Flow) streams.Flow
- func RoundRobin(outlet streams.Outlet, magnitude int) []streams.Flow
- func Split(outlet streams.Outlet, predicate func(any) bool) [2]streams.Flow
- type Filter
- type FilterPredicate
- type FlatMap
- type FlatMapFunction
- type Map
- type MapFunction
- type PassThrough
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FanOut ¶
FanOut creates a number of identical flows from the single outlet. This can be useful when writing to multiple sinks is required.
func RoundRobin ¶
RoundRobin creates a balanced number of flows from the single outlet. This can be useful when work can be parallelized across multiple cores.
Types ¶
type Filter ¶
type Filter[T any] struct { // contains filtered or unexported fields }
Filter filters incoming elements using a filter predicate. If an element matches the predicate, the element is passed downstream. If not, the element is discarded.
in -- 1 -- 2 ---- 3 -- 4 ------ 5 --
[ -------- FilterPredicate -------- ]
out -- 1 -- 2 ------------------ 5 --.
func NewFilter ¶
func NewFilter[T any](filterPredicate FilterPredicate[T], parallelism uint) *Filter[T]
NewFilter returns a new Filter instance.
filterPredicate is the boolean-valued filter function. parallelism is the flow parallelism factor. In case the events order matters, use parallelism = 1.
type FilterPredicate ¶
FilterPredicate represents a filter predicate (boolean-valued function).
type FlatMap ¶
type FlatMap[T, R any] struct { // contains filtered or unexported fields }
FlatMap takes one element and produces zero, one, or more elements.
in -- 1 -- 2 ---- 3 -- 4 ------ 5 --
[ -------- FlatMapFunction -------- ]
out -- 1' - 2' -------- 4'- 4" - 5' -.
func NewFlatMap ¶
func NewFlatMap[T, R any](flatMapFunction FlatMapFunction[T, R], parallelism uint) *FlatMap[T, R]
NewFlatMap returns a new FlatMap instance.
flatMapFunction is the FlatMap transformation function. parallelism is the flow parallelism factor. In case the events order matters, use parallelism = 1.
type FlatMapFunction ¶
type FlatMapFunction[T, R any] func(T) []R
FlatMapFunction represents a FlatMap transformation function.
type Map ¶
type Map[T, R any] struct { // contains filtered or unexported fields }
Map takes one element and produces one element.
in -- 1 -- 2 ---- 3 -- 4 ------ 5 --
[ ---------- MapFunction ---------- ]
out -- 1' - 2' --- 3' - 4' ----- 5' -.
func NewMap ¶
func NewMap[T, R any](mapFunction MapFunction[T, R], parallelism uint) *Map[T, R]
NewMap returns a new Map instance.
mapFunction is the Map transformation function. parallelism is the flow parallelism factor. In case the events order matters, use parallelism = 1.
type MapFunction ¶
type MapFunction[T, R any] func(T) R
MapFunction represents a Map transformation function.
type PassThrough ¶
type PassThrough struct {
// contains filtered or unexported fields
}
PassThrough retransmits incoming elements as is.
in -- 1 -- 2 ---- 3 -- 4 ------ 5 --
out -- 1 -- 2 ---- 3 -- 4 ------ 5 --.
func NewPassThrough ¶
func NewPassThrough() *PassThrough
NewPassThrough returns a new PassThrough instance.
func (*PassThrough) In ¶
func (pt *PassThrough) In() chan<- any
In returns an input channel for receiving data.
func (*PassThrough) Out ¶
func (pt *PassThrough) Out() <-chan any
Out returns an output channel for sending data.
func (*PassThrough) To ¶
func (pt *PassThrough) To(sink streams.Sink)
To streams data to the given sink.