pipe

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sink

func Sink[T any](ctx context.Context, input <-chan T, handle SinkHandler[T], finalize Finalizer)

func Source

func Source[T any](ctx context.Context, next SourceHandler[T], finalize Finalizer) <-chan T

func Transform

func Transform[I, O any](ctx context.Context, input <-chan I, fn TransformHandler[I, O], finalize Finalizer) <-chan O

Types

type Finalizer

type Finalizer func()
var NoOpFinalizer Finalizer = func() {}

type Pipeline

type Pipeline interface {
	Context() context.Context
	Cancel(cause error)
}

func NewPipeline

func NewPipeline(parent context.Context) Pipeline

type SinkHandler

type SinkHandler[Item any] func(Item)

type SourceHandler

type SourceHandler[Item any] func(chan<- Item)

type TransformHandler

type TransformHandler[Input, Output any] func(Input, chan<- Output)

Jump to

Keyboard shortcuts

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