Documentation ¶
Overview ¶
Wrapper for iterable objects; heap, list, ring, slice, map, channel, etc. All of them implement 1 or 2 of `Iter() iter.Seq[V]`, `Iter2() iter.Seq[K, V]`, `IntoIter() iter.Seq[V]` or `IntoIter2() iter.Seq2[K, V]`
Index ¶
- type Atter
- type Chan
- type CsvReader
- type Heap
- type JsonDecoder
- type ListAll
- type ListBackward
- type ListElementAll
- type ListElementBackward
- type MapAll
- type MapSorted
- type MapSortedFunc
- type Nexter
- type Peekable
- type Peekable2
- type Range
- type Repeatable
- type Repeatable2
- type RepeatableFunc
- type RepeatableFunc2
- type Resumable
- type Resumable2
- type RingAll
- type RingBackward
- type Scanner
- type SliceAll
- type SliceBackward
- type SqlRows
- type SyncMap
- type XmlDecoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CsvReader ¶ added in v0.0.16
CsvReader adds IntoIter2 method to *csv.Reader.
type JsonDecoder ¶ added in v0.0.6
JsonDecoder adds IntoIter2 to *json.Decoder.
type ListAll ¶ added in v0.0.5
ListAll adds Iter method to *list.ListAll.
func (ListAll[T]) Reverse ¶ added in v0.0.14
func (l ListAll[T]) Reverse() ListBackward[T]
type ListBackward ¶
ListBackward adds Iter method to *list.List. Iter returns an iterator that traverses list backward.
func (ListBackward[T]) Iter ¶
func (l ListBackward[T]) Iter() iter.Seq[T]
func (ListBackward[T]) Reverse ¶ added in v0.0.14
func (l ListBackward[T]) Reverse() ListAll[T]
type ListElementAll ¶ added in v0.0.5
ListElementAll adds Iter method to *list.Element.
func (ListElementAll[T]) Iter ¶ added in v0.0.5
func (l ListElementAll[T]) Iter() iter.Seq[T]
func (ListElementAll[T]) Reverse ¶ added in v0.0.14
func (l ListElementAll[T]) Reverse() ListElementBackward[T]
type ListElementBackward ¶ added in v0.0.4
ListElementBackward adds Iter method to *list.Element. Iter returns an iterator that traverses list backward.
func (ListElementBackward[T]) Iter ¶ added in v0.0.4
func (l ListElementBackward[T]) Iter() iter.Seq[T]
func (ListElementBackward[T]) Reverse ¶ added in v0.0.14
func (l ListElementBackward[T]) Reverse() ListElementAll[T]
type MapAll ¶
type MapAll[K comparable, V any] map[K]V
MapAll adds Iter2 method to map[K]V that merely calling maps.All.
type MapSorted ¶
MapSorted adds Iter2 to map[K]V where K is basic ordered type. Iter2 takes snapshot of keys and sort it in ascending order, then returns an iterator over pairs of the keys and values that correspond to each key.
func (MapSorted[K, V]) Reverse ¶ added in v0.0.14
func (m MapSorted[K, V]) Reverse() MapSortedFunc[map[K]V, K, V]
type MapSortedFunc ¶
type MapSortedFunc[M ~map[K]V, K comparable, V any] struct { M M Cmp func(K, K) int // contains filtered or unexported fields }
MapSortedFunc adds Iter2 to map[K]V. Iter2 takes snapshot of keys and sort it using the comparison function, then returns an iterator over pairs of the keys and values that correspond to each key.
func (MapSortedFunc[M, K, V]) Iter2 ¶
func (m MapSortedFunc[M, K, V]) Iter2() iter.Seq2[K, V]
func (MapSortedFunc[M, K, V]) Reverse ¶ added in v0.0.14
func (m MapSortedFunc[M, K, V]) Reverse() MapSortedFunc[M, K, V]
type Nexter ¶ added in v0.0.14
type Nexter[ T any, Nexter interface { Next() bool Err() error }, ] struct { Nexter Nexter Scanner func(Nexter) (T, error) }
SqlRows adds IntoIter2 to *sql.Rows. For detailed behavior, see databaseiter.SqlRows.
type Peekable ¶ added in v0.0.14
type Peekable[V any] struct { // contains filtered or unexported fields }
Peekable adds the read-ahead ability to iter.Seq[V].
The zero value of Peekable is not valid. Allocate one by NewPeekable.
func NewPeekable ¶ added in v0.0.14
NewPeekable initializes a peekable iterator. The caller must call *Peekable.Stop to release resources regardless of usage.
func (*Peekable[V]) Peek ¶ added in v0.0.14
Peek reads the next n elements without advancing the iterator. Peeked elements are only removed through the iterator returned from IntoIter.
func (*Peekable[V]) Stop ¶ added in v0.0.14
func (p *Peekable[V]) Stop()
Stop releases resources allocated by NewPeekable.
type Peekable2 ¶ added in v0.0.14
type Peekable2[K, V any] struct { // contains filtered or unexported fields }
Peekable2 adds the read-ahead ability to iter.Seq2[K, V].
The zero value of Peekable2 is not valid. Allocate one by NewPeekable2.
func NewPeekable2 ¶ added in v0.0.14
NewPeekable2 initializes a peekable iterator. The caller must call *Peekable2.Stop to release resources regardless of usage.
func (*Peekable2[K, V]) Peek ¶ added in v0.0.14
Peek reads the next n key-value pairs without advancing the iterator. Peeked pairs are only removed through the iterator returned from IntoIter.
func (*Peekable2[K, V]) Stop ¶ added in v0.0.14
func (p *Peekable2[K, V]) Stop()
Stop releases resources allocated by NewPeekable2.
type Range ¶
Range adds Iter method to the pair of 2 Numeric values.
type Repeatable ¶
Repeatable generates an iterator that generates V N times.
func (Repeatable[V]) Iter ¶
func (r Repeatable[V]) Iter() iter.Seq[V]
type Repeatable2 ¶
Repeatable2 generates an iterator that generates pairs of K and V N times.
func (Repeatable2[K, V]) Iter2 ¶
func (r Repeatable2[K, V]) Iter2() iter.Seq2[K, V]
type RepeatableFunc ¶ added in v0.0.3
RepeatableFunc generates an iterator that generates value returned from FnV N times.
func (RepeatableFunc[V]) Iter ¶ added in v0.0.3
func (r RepeatableFunc[V]) Iter() iter.Seq[V]
type RepeatableFunc2 ¶ added in v0.0.3
RepeatableFunc2 generates an iterator that generates pairs of value that FnK and FnV return N times.
func (RepeatableFunc2[K, V]) Iter2 ¶ added in v0.0.3
func (r RepeatableFunc2[K, V]) Iter2() iter.Seq2[K, V]
type Resumable ¶ added in v0.0.13
type Resumable[V any] struct { // contains filtered or unexported fields }
Resumable converts the input iter.Seq[V] into stateful form by calling iter.Pull.
The zero value of Resumable is not valid. Allocate one by NewResumable.
func NewResumable ¶ added in v0.0.13
NewResumable wraps seq into stateful form so that the iterator can be break-ed and resumed. The caller must call *Resumable.Stop to release resources regardless of usage.
func (*Resumable[V]) IntoIter ¶ added in v0.0.13
IntoIter returns an iterator over the input iterator. The iterator can be paused by break and later resumed without replaying data.
func (*Resumable[V]) Stop ¶ added in v0.0.13
func (r *Resumable[V]) Stop()
Stop releases resources allocated by NewResumable.
type Resumable2 ¶ added in v0.0.13
type Resumable2[K, V any] struct { // contains filtered or unexported fields }
Resumable2 converts the input iter.Seq2[K, V] into stateful form by calling iter.Pull2.
The zero value of Resumable2 is not valid. Allocate one by NewResumable2.
func NewResumable2 ¶ added in v0.0.13
func NewResumable2[K, V any](seq iter.Seq2[K, V]) *Resumable2[K, V]
NewResumable2 wraps seq into stateful form so that the iterator can be break-ed and resumed. The caller must call *Resumable2.Stop to release resources regardless of usage.
func (*Resumable2[K, V]) IntoIter2 ¶ added in v0.0.13
func (r *Resumable2[K, V]) IntoIter2() iter.Seq2[K, V]
IntoIter2 returns an iterator over the input iterator. The iterator can be paused by break and later resumed without replaying data.
func (*Resumable2[K, V]) Stop ¶ added in v0.0.13
func (r *Resumable2[K, V]) Stop()
Stop releases resources allocated by NewResumable2.
type RingAll ¶ added in v0.0.9
RingAll adds Iter method to *ring.RingAll.
func (RingAll[T]) Reverse ¶ added in v0.0.14
func (r RingAll[T]) Reverse() RingBackward[T]
type RingBackward ¶
RingBackward adds Iter method to *ring.Ring. Iter returns an iterator that traverses ring backward.
func (RingBackward[T]) Iter ¶
func (r RingBackward[T]) Iter() iter.Seq[T]
func (RingBackward[T]) Reverse ¶ added in v0.0.14
func (r RingBackward[T]) Reverse() RingAll[T]
type SliceAll ¶
type SliceAll[E any] []E
SliceAll adds Iter and Iter2 methods to slice of any element E. They merely call slices.Values, slices.All respectively.
func (SliceAll[E]) Reverse ¶ added in v0.0.14
func (s SliceAll[E]) Reverse() SliceBackward[E]
type SliceBackward ¶
type SliceBackward[E any] []E
SliceBackward adds Iter and Iter2 methods to slice of any element E. They return iterators over []E traversing them backward with descending indices.
func (SliceBackward[E]) Iter ¶
func (s SliceBackward[E]) Iter() iter.Seq[E]
func (SliceBackward[E]) Reverse ¶ added in v0.0.14
func (s SliceBackward[E]) Reverse() SliceAll[E]
type SqlRows ¶ added in v0.0.9
SqlRows adds IntoIter2 to *sql.Rows. For detailed behavior, see databaseiter.SqlRows.
type SyncMap ¶
type SyncMap[K comparable, V any] struct { *sync.Map }
SyncMap adds Iter2 method that merely calls sync.Map.Range.
type XmlDecoder ¶ added in v0.0.6
XmlDecoder adds IntoIter2 to *xml.Decoder.