Documentation ¶
Index ¶
- func Collect[T any](itr Iterator[T]) ([]T, error)
- func CollectInto[T any](itr Iterator[T], into []T) ([]T, error)
- func Identity[A any](a A) A
- type CancellableIter
- type CloseIter
- type CloseIterator
- type CloseResetIterator
- type CloserIter
- type CountIterator
- type CounterIter
- type DedupeIter
- type EmptyIter
- type FilterIter
- type Iterator
- type MapIter
- type Ord
- type Orderable
- type OrderedImpl
- type PeekCloseIter
- type PeekCloseIterator
- type PeekIter
- type PeekIterator
- type Predicate
- type ResetIterator
- type SeekIterator
- type SizedIterator
- type SliceIter
- type UnlessIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectInto ¶
CollectInto collects the elements of an iterator into a provided slice which is returned
Types ¶
type CancellableIter ¶
func NewCancelableIter ¶
func NewCancelableIter[T any](ctx context.Context, itr Iterator[T]) *CancellableIter[T]
func (*CancellableIter[T]) Err ¶
func (cii *CancellableIter[T]) Err() error
func (*CancellableIter[T]) Next ¶
func (cii *CancellableIter[T]) Next() bool
type CloseIterator ¶
type CloseResetIterator ¶
type CloseResetIterator[T any] interface { CloseIterator[T] ResetIterator[T] }
type CloserIter ¶
func NewCloserIter ¶
func NewCloserIter[T io.Closer](itr Iterator[T]) *CloserIter[T]
func (*CloserIter[T]) Close ¶
func (i *CloserIter[T]) Close() error
type CountIterator ¶
type CounterIter ¶
type CounterIter[T any] struct { Iterator[T] // the underlying iterator // contains filtered or unexported fields }
func NewCounterIter ¶
func NewCounterIter[T any](itr Iterator[T]) *CounterIter[T]
func (*CounterIter[T]) Count ¶
func (it *CounterIter[T]) Count() int
func (*CounterIter[T]) Next ¶
func (it *CounterIter[T]) Next() bool
type DedupeIter ¶
type DedupeIter[A, B any] struct { // contains filtered or unexported fields }
DedupeIter is a deduplicating iterator which creates an Iterator[B] from a sequence of Iterator[A].
func NewDedupingIter ¶
func NewDedupingIter[A, B any]( eq func(A, B) bool, from func(A) B, merge func(A, B) B, itr PeekIterator[A], ) *DedupeIter[A, B]
func (*DedupeIter[A, B]) At ¶
func (it *DedupeIter[A, B]) At() B
func (*DedupeIter[A, B]) Err ¶
func (it *DedupeIter[A, B]) Err() error
func (*DedupeIter[A, B]) Next ¶
func (it *DedupeIter[A, B]) Next() bool
type EmptyIter ¶
type EmptyIter[T any] struct { // contains filtered or unexported fields }
func NewEmptyIter ¶
type FilterIter ¶
func NewFilterIter ¶
func NewFilterIter[T any](it Iterator[T], p Predicate[T]) *FilterIter[T]
func (*FilterIter[T]) Next ¶
func (i *FilterIter[T]) Next() bool
type Iterator ¶
Iterator is the basic iterator type with the common functions for advancing and retrieving the current value.
General usage of the iterator:
for it.Next() { curr := it.At() // do something } if it.Err() != nil { // do something }
type OrderedImpl ¶
type OrderedImpl[T any] struct { // contains filtered or unexported fields }
func NewOrderable ¶
func NewOrderable[T any](val T, cmp func(T, T) Ord) OrderedImpl[T]
convenience method for creating an Orderable implementation for a type dynamically by passing in a value and a comparison function This is useful for types that are not under our control, such as built-in types and for reducing boilerplate in testware/etc. Hot-path code should use a statically defined Orderable implementation for performance
func (OrderedImpl[T]) Compare ¶
func (o OrderedImpl[T]) Compare(other OrderedImpl[T]) Ord
func (OrderedImpl[T]) Unwrap ¶
func (o OrderedImpl[T]) Unwrap() T
type PeekCloseIter ¶
func NewPeekCloseIter ¶
func NewPeekCloseIter[T any](itr CloseIterator[T]) *PeekCloseIter[T]
func (*PeekCloseIter[T]) Close ¶
func (it *PeekCloseIter[T]) Close() error
type PeekCloseIterator ¶
type PeekCloseIterator[T any] interface { PeekIterator[T] CloseIterator[T] }
type PeekIter ¶
type PeekIter[T any] struct { // contains filtered or unexported fields }
func NewPeekIter ¶
type PeekIterator ¶
type ResetIterator ¶
type SeekIterator ¶
type SizedIterator ¶
type SliceIter ¶
type SliceIter[T any] struct { // contains filtered or unexported fields }
func NewSliceIter ¶
type UnlessIterator ¶
type UnlessIterator[T Orderable[T]] struct { // contains filtered or unexported fields }
func NewUnlessIterator ¶
func NewUnlessIterator[T Orderable[T]](a, b Iterator[T]) *UnlessIterator[T]
Iterators _must_ be sorted. Defers to underlying `PeekingIterator` implementation for both iterators if they implement it.
func (*UnlessIterator[T]) At ¶
func (it *UnlessIterator[T]) At() T
func (*UnlessIterator[T]) Err ¶
func (it *UnlessIterator[T]) Err() error
func (*UnlessIterator[T]) Next ¶
func (it *UnlessIterator[T]) Next() bool