Documentation
¶
Index ¶
- func ForEach[V any](it Iterator[*V], consume ConsumeFunc[*V]) error
- func GetFirst[T any](vs Iterator[T]) (T, error)
- func GetUnique[T any](vs Iterator[T]) (T, error)
- func ReadAllPointers[T any](it Iterator[*T]) ([]*T, error)
- func ReadAllValues[T any](it Iterator[*T]) ([]T, error)
- func ReadFirst[T any](it Iterator[*T], limit int) ([]T, error)
- func Reduce[V any, S any](it Iterator[*V], reducer Reducer[*V, S]) (S, error)
- func ReduceValue[V any, S any](it Iterator[*V], result S, reduce ReduceFunc[*V, S]) (S, error)
- type ConsumeFunc
- type Iterator
- func Batch[V any](it Iterator[*V], batchSize uint32) Iterator[*[]*V]
- func Copy[T any](it Iterator[*T]) (Iterator[*T], error)
- func Empty[K any]() Iterator[K]
- func Filter[A any](iterator Iterator[*A], filter Predicate[*A]) Iterator[*A]
- func Map[A any, B any](iterator Iterator[A], transformer Transformer[A, B]) Iterator[B]
- type PermutatableIterator
- type Predicate
- type ReduceFunc
- type Reducer
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForEach ¶
func ForEach[V any](it Iterator[*V], consume ConsumeFunc[*V]) error
ForEach executes the given ConsumeFunc for each element of the Iterator
func GetUnique ¶
GetUnique returns the unique element of an Iterator, when there is supposed to be only one
func ReadAllPointers ¶
ReadAllPointers reads all pointer elements of an Iterator and returns them
func ReadAllValues ¶
ReadAllValues reads all pointer elements of an Iterator and returns the values No nil elements are expected!
func ReduceValue ¶
func ReduceValue[V any, S any](it Iterator[*V], result S, reduce ReduceFunc[*V, S]) (S, error)
Types ¶
type ConsumeFunc ¶
type Iterator ¶
type Iterator[V any] interface { // Close releases resources occupied by the iterator Close() // contains filtered or unexported methods }
func Batch ¶
Batch lazily batches the elements of an iterator into groups of {{batchSize}} sized batches Each element of the output Iterator will now be a batch, i.e. a slice of the initial elements
type PermutatableIterator ¶
func From ¶
func From[T any](items ...T) PermutatableIterator[T]
From creates an Iterator containing the passed elements
func Permutate ¶
func Permutate[T any](it Iterator[*T]) (PermutatableIterator[*T], error)
Permutate creates a new Iterator that contains the elements of the input Iterator permutated
func Slice ¶
func Slice[T any](items []T) PermutatableIterator[T]
Slice creates an iterator from the elements of the passed slice
type Predicate ¶
func DuplicatesBy ¶
func DuplicatesBy[V any, I comparable](prop func(V) I) Predicate[V]
DuplicatesBy is used for filtering duplicate elements by a comparable property
type ReduceFunc ¶
type Reducer ¶
func NewReducer ¶
func NewReducer[V any, S any](initial S, merge ReduceFunc[V, S]) Reducer[V, S]
NewReducer creates a generic reducer
func ToFlattened ¶
ToFlattened creates a reducer that collects the slice elements of an Iterator into a flattened slice