stream

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error[T any](err error) iter.Seq2[T, error]

Error returns a iter.Seq2 that emits the provided error.

func Filter

func Filter[T any](stream iter.Seq2[T, error], predicate func(T) bool) iter.Seq2[T, error]

Filter returns a iter.Seq2 that emits only the values from the input stream that satisfy the given predicate function.

func Just

func Just[T any](values ...T) iter.Seq2[T, error]

Just returns a iter.Seq2 that emits the provided values in order.

func Map

func Map[T, R any](stream iter.Seq2[T, error], mapper func(T) (R, error)) iter.Seq2[R, error]

Map returns a iter.Seq2 that emits the results of applying the given mapper function to each value from the input stream.

func Merge

func Merge[T any](streams ...iter.Seq2[T, error]) iter.Seq2[T, error]

Merge takes multiple input streams (as iter.Seq2) and merges their outputs into a single output stream.

func Observe

func Observe[T any](stream iter.Seq2[T, error], observer func(T, error) error) iter.Seq2[T, error]

Observe returns a channel that emits the results of applying the given observer function to each value from the input channel. The observer function is called for each value and returns an error; if a non-nil error is returned, observation stops and the error is emitted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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