Documentation
¶
Overview ¶
Package stream provides a stream implementation and helper functions
Index ¶
- type Iter
- func (k Iter[K, V, M]) Filt(predicate func(K, V) (bool, error)) Iter[K, V, M]
- func (k Iter[K, V, M]) FiltKey(predicate func(K) (bool, error)) Iter[K, V, M]
- func (k Iter[K, V, M]) FiltValue(predicate func(V) (bool, error)) 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, error)) (bool, error)
- func (k Iter[K, V, M]) Iter() kv.Iterator[K, V]
- func (k Iter[K, V, M]) Map() (M, error)
- func (k Iter[K, V, M]) Next() (K, V, bool, error)
- func (k Iter[K, V, M]) Reduce(by func(K, V, K, V) (K, V, error)) (K, V, error)
- func (k Iter[K, V, M]) Track(tracker func(K, V) error) error
- 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, error), collector MapCollector[K, V, M]) Iter[K, V, M]
New is the main stream constructor
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
type MapCollector ¶
type MapCollector[K comparable, V any, M map[K]V | map[K][]V] func(next func() (K, V, bool, error)) (M, error)
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, Map map[K]V | map[K][]V] interface { kv.Iterator[K, V] Iter() kv.Iterator[K, V] Map() (Map, error) Reduce(merger func(K, V, K, V) (K, V, error)) (K, V, error) HasAny(predicate func(K, V) (bool, error)) (bool, error) }
Stream is map or key/value stream of elements in transformation state.