Documentation
¶
Overview ¶
Package stream provides a stream implementation and helper functions
Index ¶
- type Iter
- func (k Iter[K, V, M]) Conv(converter func(K, V) (K, V, error)) stream.Iter[K, V, M]
- func (k Iter[K, V, M]) ConvKey(by func(K) (K, error)) stream.Iter[K, V, M]
- func (k Iter[K, V, M]) ConvValue(converter func(V) (V, error)) stream.Iter[K, V, M]
- func (k Iter[K, V, M]) Convert(converter func(K, V) (K, V)) Iter[K, V, M]
- func (k Iter[K, V, M]) ConvertKey(by func(K) K) Iter[K, V, M]
- func (k Iter[K, V, M]) ConvertValue(converter func(V) V) Iter[K, V, M]
- func (k Iter[K, V, M]) Filt(predicate func(K, V) (bool, error)) stream.Iter[K, V, M]
- func (k Iter[K, V, M]) FiltKey(predicate func(K) (bool, error)) stream.Iter[K, V, M]
- func (k Iter[K, V, M]) FiltValue(predicate func(V) (bool, error)) stream.Iter[K, V, M]
- func (k Iter[K, V, M]) Filter(predicate func(K, V) bool) Iter[K, V, M]
- func (k Iter[K, V, M]) FilterKey(predicate func(K) bool) Iter[K, V, M]
- func (k Iter[K, V, M]) FilterValue(predicate func(V) bool) Iter[K, V, M]
- func (k Iter[K, V, M]) HasAny(predicate func(K, V) bool) bool
- func (k Iter[K, V, M]) Iter() kv.Iterator[K, V]
- func (k Iter[K, V, M]) Loop() Iter[K, V, M]
- func (k Iter[K, V, M]) Map() M
- func (k Iter[K, V, M]) Next() (K, V, bool)
- func (k Iter[K, V, M]) Reduce(by func(K, K, V, V) (K, V)) (K, V)
- func (k Iter[K, V, M]) Track(tracker func(K, V) error) error
- func (k Iter[K, V, M]) TrackEach(tracker func(K, V))
- type MapCollector
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iter ¶
type Iter[K comparable, V any, M map[K]V | map[K][]V] struct { // contains filtered or unexported fields }
Iter is the key/value Iterator based stream implementation.
func New ¶
func New[K comparable, V any, M map[K]V | map[K][]V](next func() (K, V, bool), collector MapCollector[K, V, M]) Iter[K, V, M]
New instantiates StreamIter
func (Iter[K, V, M]) Conv ¶
Conv returns a breakable stream that applies the 'converter' function to the collection elements
func (Iter[K, V, M]) ConvKey ¶
ConvKey returns a stream that applies the 'converter' function to keys of the map
func (Iter[K, V, M]) ConvValue ¶
ConvValue returns a stream that applies the 'converter' function to values of the map
func (Iter[K, V, M]) Convert ¶
Convert returns a stream that applies the 'converter' function to the collection elements
func (Iter[K, V, M]) ConvertKey ¶
ConvertKey returns a stream that applies the 'converter' function to keys of the map
func (Iter[K, V, M]) ConvertValue ¶
ConvertValue returns a stream that applies the 'converter' function to values of the map
func (Iter[K, V, M]) Filt ¶
Filt returns a breakable stream consisting of elements that satisfy the condition of the 'predicate' function
func (Iter[K, V, M]) FiltKey ¶
FiltKey returns a stream consisting of key/value pairs where the key satisfies the condition of the 'predicate' function
func (Iter[K, V, M]) FiltValue ¶
FiltValue returns a stream consisting of key/value pairs where the value satisfies the condition of the 'predicate' function
func (Iter[K, V, M]) Filter ¶
Filter returns a stream consisting of elements that satisfy the condition of the 'predicate' function
func (Iter[K, V, M]) FilterKey ¶
FilterKey returns a stream consisting of key/value pairs where the key satisfies the condition of the 'predicate' function
func (Iter[K, V, M]) FilterValue ¶
FilterValue returns a stream consisting of key/value pairs where the value satisfies the condition of the 'predicate' function
func (Iter[K, V, M]) HasAny ¶
HasAny finds the first key/value pari that satisfies the 'predicate' function condition and returns true if successful
func (Iter[K, V, M]) Reduce ¶
func (k Iter[K, V, M]) Reduce(by func(K, K, V, V) (K, V)) (K, V)
Reduce reduces the key/value pairs into an one pair using the 'merge' function
type MapCollector ¶
type MapCollector[K comparable, V any, M map[K]V | map[K][]V] func(next func() (K, V, bool)) M
MapCollector is Converter of key/value Iterator that collects all values to any slice or map, mostly used to extract slice fields to flatting a result
type Stream ¶
type Stream[K comparable, V any, M map[K]V | map[K][]V] interface { kv.Iterator[K, V] kv.Collection[K, V, M] HasAny(func(K, V) bool) bool }
Stream is map or key/value stream of elements in transformation state.