Documentation ¶
Index ¶
- func Async[T any](it Iterator[T], cx context.Context) chan T
- func Count[T any](iterator Iterator[T]) int
- func ForEach[T any](iterator Iterator[T], action func(t T))
- func ForEachIndex[T any](iterator Iterator[T], action func(i int, t T))
- func ToSlice[T any](iterator Iterator[T]) []T
- type ChannelOption
- type Iterator
- func FromChannel[T any](ch chan T, options ...ChannelOption[T]) Iterator[T]
- func FromMap[TKey comparable, TValue any](m map[TKey]TValue) Iterator[types.Tuple2[TKey, TValue]]
- func FromMapAsync[TKey comparable, TValue any](m map[TKey]TValue, cx context.Context) Iterator[types.Tuple2[TKey, TValue]]
- func FromSlice[T any](slice []T) Iterator[T]
- func Range[T constraints.Integer](begin T, end T) Iterator[T]
- func Repeat[T any](element T, count int) Iterator[T]
- func Select[TSource, TTarget any](iterator Iterator[TSource], transform func(TSource) TTarget) Iterator[TTarget]
- func Where[T any](iterator Iterator[T], where func(t T) bool) Iterator[T]
- func Zip[T1, T2 any](iter1 Iterator[T1], iter2 Iterator[T2]) Iterator[types.Tuple2[T1, T2]]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Async ¶ added in v0.2.2
Async returns a channel for the given iterator over the context. If the context is canceled, the Async function will return immediately.
func ForEachIndex ¶
Types ¶
type ChannelOption ¶
type ChannelOption[T any] func(*channelIterator[T])
func WithContext ¶
func WithContext[T any](cx context.Context) ChannelOption[T]
type Iterator ¶
type Iterator[T any] interface { Next() types.Option[T] }
Iterator defines a generic iterface for iterating over a sequence
func FromChannel ¶
func FromChannel[T any](ch chan T, options ...ChannelOption[T]) Iterator[T]
func FromMap ¶
func FromMap[TKey comparable, TValue any](m map[TKey]TValue) Iterator[types.Tuple2[TKey, TValue]]
func FromMapAsync ¶ added in v0.2.1
func FromMapAsync[TKey comparable, TValue any](m map[TKey]TValue, cx context.Context) Iterator[types.Tuple2[TKey, TValue]]
FromMapAsync returns a call to FromChannel with a channel created by iterating over the map in a go routine The context passed in is used to pass the WithContext chanel option to the FromChannel call
func Range ¶
func Range[T constraints.Integer](begin T, end T) Iterator[T]
func Repeat ¶ added in v0.2.0
Repeat returns an iterator that repeats the given `element` `count` times
Click to show internal directories.
Click to hide internal directories.