Documentation
¶
Overview ¶
Package stream contains domain-neutral, typed lazy stream operators.
Index ¶
- type StreamOp
- func Batch[T any](size int) StreamOp[T, []T]
- func Collect[T any](maxItems int) StreamOp[T, []T]
- func Filter[T any](pred func(T) bool) StreamOp[T, T]
- func FlatMap[In, Out any](fn func(In) iter.Seq2[Out, error]) StreamOp[In, Out]
- func Map[In, Out any](fn func(In) Out) StreamOp[In, Out]
- func MapE[In, Out any](fn func(In) (Out, error)) StreamOp[In, Out]
- func Reduce[T, Acc any](initial Acc, fn func(Acc, T) (Acc, error)) StreamOp[T, Acc]
- func Take[T any](n int) StreamOp[T, T]
- func WithContext[T any](ctx context.Context) StreamOp[T, T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StreamOp ¶
StreamOp transforms a lazy stream without erasing its item types.
func Batch ¶
Batch groups successful items into bounded batches. A final partial batch is emitted when the upstream ends normally.
func Collect ¶
Collect materializes a bounded stream into one item. A non-positive limit is rejected at iteration time so the operator remains lazy.
func FlatMap ¶
FlatMap expands each successful item sequentially. The inner stream must honor the downstream yield result; no goroutine is created per item.
Click to show internal directories.
Click to hide internal directories.