stream

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoChunkFunc

type DoChunkFunc[V any] func(from, to int, chunk []V) error

type DoFunc

type DoFunc[V any] func(i int, a V) error

type EqFunc

type EqFunc[V any] func(i int, a V, j int, b V) bool

type ExpandFunc

type ExpandFunc[V any] func(i int, a V) []V

type ExtractComparableKeyFunc

type ExtractComparableKeyFunc[V any, K comparable] func(i int, a V) K

type ExtractKeyFunc

type ExtractKeyFunc[V any] func(i int, a V) interface{}

type FilterFunc

type FilterFunc[V any] func(i int, a V) bool

type MergeValuesFunc

type MergeValuesFunc[V any, W any, VW any] func(okV bool, v V, okW bool, w W) []VW

type PeekFunc

type PeekFunc[V any] func(i int, a V)

type SortFunc

type SortFunc[V any] func(i int, a V, j int, b V) bool

type Stream

type Stream[V any] interface {
	First() (V, bool)
	FirstBy(checkValues FilterFunc[V]) (int, V, bool)
	Last() (V, bool)
	LastBy(checkValues FilterFunc[V]) (int, V, bool)
	Count() int
	AllMatch(checkValues FilterFunc[V]) bool
	AnyMatch(checkValues FilterFunc[V]) bool
	NoneMatch(checkValues FilterFunc[V]) bool
	ForEach(do DoFunc[V]) error
	ForEachAsync(do DoFunc[V]) error
	ForEachChunk(chunkSize int, do DoChunkFunc[V]) error
	ForEachChunkAsync(chunkSize int, do DoChunkFunc[V]) error
	Get() []V
	Reverse() Stream[V]
	Sort(sortValues SortFunc[V]) Stream[V]
	Filter(checkValues FilterFunc[V]) Stream[V]
	Peek(peekValues PeekFunc[V]) Stream[V]
	Expand(remap ExpandFunc[V]) Stream[V]
	Limit(int) Stream[V]
	Skip(int) Stream[V]
	Distinct(compareValues EqFunc[V]) Stream[V]
	DistinctByKey(distinctKey ExtractKeyFunc[V]) Stream[V]
}

func Join

func Join[V any, W any, VW any, K comparable](sLeft Stream[V], extractKeyLeft ExtractComparableKeyFunc[V, K], sRight Stream[W], extractKeyRight ExtractComparableKeyFunc[W, K], merge MergeValuesFunc[V, W, VW]) Stream[VW]

func New

func New[V any](slice ...V) Stream[V]

func Wrap

func Wrap[V any, NV any](s Stream[V], wrapValue WrapValueFunc[V, NV]) Stream[NV]

type WrapValueFunc

type WrapValueFunc[V any, NV any] func(i int, value V) []NV

Jump to

Keyboard shortcuts

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