Documentation
¶
Overview ¶
Package iterx provides some extensions to the base iter.Seq and iter.Seq2 types.
Index ¶
- func PartitionSlice[T any, K comparable](i SliceIter[T], partitionFn func(T) K) map[K]SliceIter[T]
- type Filter
- type MapIter
- func (i MapIter[K, V]) Count() int
- func (i MapIter[K, V]) FilterKeys(filter Filter[K]) MapIter[K, V]
- func (i MapIter[K, V]) FilterValues(filter Filter[V]) MapIter[K, V]
- func (i MapIter[K, V]) First() (K, V, bool)
- func (i MapIter[K, V]) ForEach(handler func(key K, val V) bool)
- func (i MapIter[K, V]) Keys() SliceIter[K]
- func (i MapIter[K, V]) Limit(limit int) MapIter[K, V]
- func (i MapIter[K, V]) Map() map[K]V
- func (i MapIter[K, V]) Values() SliceIter[V]
- type SliceIter
- func (i SliceIter[T]) Count() int
- func (i SliceIter[T]) Filter(filter Filter[T]) SliceIter[T]
- func (i SliceIter[T]) First() (T, bool)
- func (i SliceIter[T]) ForEach(handler func(val T) bool)
- func (i SliceIter[T]) Limit(limit int) SliceIter[T]
- func (i SliceIter[T]) Slice() []T
- func (i SliceIter[T]) WithIndex() MapIter[int, T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PartitionSlice ¶
func PartitionSlice[T any, K comparable](i SliceIter[T], partitionFn func(T) K) map[K]SliceIter[T]
PartitionSlice will break a SliceIter into groups based on the result of partitionFn.
Types ¶
type Filter ¶
Filter is a function that returns true if the element of an iter.Seq should be yielded to the caller.
func NoZeroValues ¶
func NoZeroValues[T comparable]() Filter[T]
NoZeroValues creates a Filter that excludes elements that are the zero value for the type. The underlying type must be comparable.
func NotEqual ¶
func NotEqual[T comparable](val T) Filter[T]
NotEqual creates a Filter that excludes elements that equal the value. The underlying type must be comparable.
type MapIter ¶
type MapIter[K comparable, V any] iter.Seq2[K, V]
func SelectMap ¶
func SelectMap[K comparable, V any](m map[K]V) MapIter[K, V]
SelectMap translates any map to a MapIter.
func (MapIter[K, V]) FilterKeys ¶
func (MapIter[K, V]) FilterValues ¶
type SliceIter ¶
func Select ¶
Select will use the provided Filter to select elements from a slice, returning a SliceIter.
Click to show internal directories.
Click to hide internal directories.