iter

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package iter provides generic constructors and helpers for key/value iterators

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[K comparable, V any, I kv.Iterator[K, V]](elements I, filter func(K, V) bool) stream.Iter[K, V, map[K]V]

Filter instantiates key/value iterator that iterates only over filtered elements

func FilterKey

func FilterKey[K comparable, V any, I kv.Iterator[K, V]](elements I, fit func(K) bool) stream.Iter[K, V, map[K]V]

FilterKey instantiates key/value iterator that iterates only over elements that filtered by the key

func FilterValue

func FilterValue[K comparable, V any, I kv.Iterator[K, V]](elements I, fit func(V) bool) stream.Iter[K, V, map[K]V]

FilterValue instantiates key/value iterator that iterates only over elements that filtered by the value

func FromIter

func FromIter[T, K, V any, I c.Iterator[T]](elements I, keyExtractor func(T) K, valExtractor func(T) V) loop.KeyValuer[T, K, V]

FromIter converts a c.Iterator to a kv.KVIterator using key and value extractors

func FromPairs

func FromPairs[K, V any, I c.Iterator[c.KV[K, V]]](elements I) loop.KeyValuer[c.KV[K, V], K, V]

FromPairs converts an iterator of key\value pair elements to a KVIterator

func Group

func Group[K comparable, V any, I kv.Iterator[K, V]](elements I) map[K][]V

Group collects sets of values grouped by keys obtained by passing a key/value iterator

func Map

func Map[K comparable, V any, KOUT comparable, VOUT any, I kv.Iterator[K, V]](elements I, by func(K, V) (KOUT, VOUT)) stream.Iter[KOUT, VOUT, map[KOUT]VOUT]

Map instantiates key/value iterator that converts elements with a converter and returns them

func OfPairs

func OfPairs[K, V any](pairs ...c.KV[K, V]) loop.KeyValuer[c.KV[K, V], K, V]

OfPairs instantiates KVIterator of predefined key\value pairs

func Reduce

func Reduce[K comparable, V any, I kv.Iterator[K, V]](elements I, merge func(K, V, K, V) (K, V)) (K, V)

Reduce reduces keys/value pairs to an one pair

func WrapPairs

func WrapPairs[K, V any, P ~[]c.KV[K, V]](pairs P) loop.KeyValuer[c.KV[K, V], K, V]

WrapPairs instantiates KVIterator using slice as the key\value pairs source

Types

This section is empty.

Directories

Path Synopsis
Package group provides short aliases for functions that are used to group key/values retieved by an iterator
Package group provides short aliases for functions that are used to group key/values retieved by an iterator

Jump to

Keyboard shortcuts

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