Documentation
¶
Index ¶
- func Append[T any](t T, s iter.Seq[T]) iter.Seq[T]
- func Chan[T any](ch <-chan T) iter.Seq[T]
- func Chunk[T any](s iter.Seq[T], chunkSize int) iter.Seq[[]T]
- func Collect[T any](s iter.Seq[T]) []T
- func CollectInto[T, C any](s iter.Seq[T], collection C, addElement func(element T, collection C) C) C
- func Csv(r io.ReadCloser) iter.Seq2[[]string, error]
- func Elide[T any](s iter.Seq2[T, error]) iter.Seq[T]
- func Enumerate[T any](s iter.Seq[T]) iter.Seq2[int, T]
- func Filter[T any](s iter.Seq[T], filter func(T) bool) iter.Seq[T]
- func First[T any](s iter.Seq[T], predicate func(T) bool) (t T, ok bool)
- func IsSorted[T cmp.Ordered](s iter.Seq[T]) int
- func IsSortedBy[T any](s iter.Seq[T], order func(a, b T) int) int
- func Json(r io.ReadCloser) iter.Seq2[json.Token, error]
- func Map[T, U any](s iter.Seq[T], mapper func(T) U) iter.Seq[U]
- func Max[T cmp.Ordered](s iter.Seq[T]) (t T, ok bool)
- func Min[T cmp.Ordered](s iter.Seq[T]) (t T, ok bool)
- func Prepend[T any](t T, s iter.Seq[T]) iter.Seq[T]
- func Reduce[T, U any](s iter.Seq[T], reduce func(t T, u U) U, init U) U
- func Seq2Seq[K, V any](s iter.Seq2[K, V]) iter.Seq[Pair[K, V]]
- func Skip[T any](s iter.Seq[T], n int) iter.Seq[T]
- func SliceRef[T any](s []T) iter.Seq[*T]
- func Sorted[T cmp.Ordered](s iter.Seq[T]) iter.Seq[T]
- func SortedBy[T any](s iter.Seq[T], order func(a, b T) int) iter.Seq[T]
- func Sql(rows *sql.Rows) iter.Seq[func(...any) error]
- func Take[T any](s iter.Seq[T], n int) iter.Seq[T]
- func Tee[T any](s iter.Seq[T], yield1 func(t T) bool) iter.Seq[T]
- func Unique[T comparable](s iter.Seq[T]) iter.Seq[T]
- func Until[T any](s iter.Seq[T], until func(T) bool) iter.Seq[T]
- type Pair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectInto ¶
func CollectInto[T, C any](s iter.Seq[T], collection C, addElement func(element T, collection C) C) C
CollectInto collects s into collection useing collectInto
func IsSorted ¶
IsSorted returns: 1: array is sorted in ascending order 0: array is unsorted -1: array is sorted in descending order
func IsSortedBy ¶
IsSortedBy returns: 1: array is sorted in ascending order 0: array is unsorted -1: array is sorted in descending order
func Prepend ¶
Prepend t to s. This helps solve one of my least favorite features of ticker:
for now := range Prepend(time.Now(), Chan(time.Tick(duration))) {
// do ticker-y logic
}
func SliceRef ¶
SliceRef returns an iter.Seq which yields references to values in the slice. This is useful when the slice contains large values which shouldn't be copied.
func Sql ¶
Sql creates an iter.Seq from sql.Rows. Each row gives the opportunity to scan the row into a struct. Takes ownership of the rows.