pp

package module
v0.0.0-...-3380cad Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: Apache-2.0 Imports: 2 Imported by: 9

README

pp

pipeline utils

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrShortSink = errors.New("short sink")

Functions

func Copy

func Copy(src Src, sinks ...Sink) error

Types

type Sink

type Sink func(any) (Sink, error)

Sink consumes stream of values

for non-higher-order Sinks, a nil input value indicates the end of stream for higher-order Sinks, a nil input value should pass as-is to argument sinks

func Alt

func Alt(sinks ...Sink) Sink

func CatSink

func CatSink(sinks ...Sink) Sink

func CollectValues

func CollectValues(p *Values) Sink

func CountSink

func CountSink(n *int) Sink

func Discard

func Discard(v any) (Sink, error)

func FilterSink

func FilterSink(
	sink Sink,
	predict func(any) bool,
) Sink

func MapSink

func MapSink(
	sink Sink,
	fn func(any) any,
) Sink

func Tap

func Tap(fn func(any) error) Sink

func (Sink) Sink

func (s Sink) Sink(v any) (Sink, error)

type Src

type Src func() (any, Src, error)

Src provides stream of values

returning value may be nil, which does not indicate the end of stream returning nil Src indicates the end of stream

func CapSrc

func CapSrc(src Src, n int, cont Src) Src

func CatSrc

func CatSrc(srcs ...Src) Src

func CountSrc

func CountSrc(n *int, src Src, cont Src) Src

func FilterSrc

func FilterSrc(
	src Src,
	predict func(any) bool,
	cont Src,
) Src

func MapSrc

func MapSrc(
	src Src,
	fn func(any) any,
	cont Src,
) Src

func Seq

func Seq(values ...any) Src

func SkipSrc

func SkipSrc(src Src, n int, cont Src) Src

func Tee

func Tee(src Src, sinks ...Sink) Src

func TeeSrc

func TeeSrc(
	src Src,
	sinks []Sink,
	cont Src,
) Src

func (*Src) Next

func (s *Src) Next() (value any, err error)

Next returns the next non-null value, or returns nil if Src is nil

type Values

type Values []any

func (Values) Iter

func (v Values) Iter(cont Src) Src

Jump to

Keyboard shortcuts

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