iterx

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package iterx provides convenience functions for iterators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSVFile

func CSVFile(file string, fn func(*csv.Reader)) iter.Seq2[[]string, error]

CSVFile iterates over CSV entries from a file. fn is an optional function for modifying the CSV parser, for example for changing the delimiter.

func CSVReader

func CSVReader(r io.Reader, fn func(*csv.Reader)) iter.Seq2[[]string, error]

CSVReader iterates over CSV entries from a reader. fn is an optional function for modifying the CSV parser, for example for changing the delimiter.

func ISlice

func ISlice[T any](s []T) iter.Seq2[int, T]

ISlice returns an iterator over the slice values and their indices, like in a range expression.

func Limit

func Limit[T any](it iter.Seq[T], n int) iter.Seq[T]

Limit returns an iterator that stops after n elements, if the underlying iterator does not stop before.

func Limit2

func Limit2[T any, S any](it iter.Seq2[T, S], n int) iter.Seq2[T, S]

Limit2 returns an iterator that stops after n elements, if the underlying iterator does not stop before.

func LinesFile

func LinesFile(file string) iter.Seq2[string, error]

LinesFile iterates over text lines from a reader.

func LinesReader

func LinesReader(r io.Reader) iter.Seq2[string, error]

LinesReader iterates over text lines from a reader.

func Skip

func Skip[T any](it iter.Seq[T], n int) iter.Seq[T]

Skip returns an iterator without the first n elements.

func Skip2

func Skip2[T any, S any](it iter.Seq2[T, S], n int) iter.Seq2[T, S]

Skip2 returns an iterator without the first n elements.

func Slice

func Slice[T any](s []T) iter.Seq[T]

Slice returns an iterator over the slice values.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL