iter

package
v0.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map[T any, R any](iter Iter[T], mapper func(t T) (R, error)) ([]R, error)

func ToSlice

func ToSlice[T any](iter Iter[T]) ([]T, error)

Types

type BlobIter

type BlobIter struct {
	// contains filtered or unexported fields
}

func FromReadCloser

func FromReadCloser(r io.ReadCloser) *BlobIter

FromReadCloser returns an iterator producing lines from the given reader.

func (*BlobIter) Close

func (it *BlobIter) Close() error

func (*BlobIter) Next

func (it *BlobIter) Next() bool

func (*BlobIter) Value

func (it *BlobIter) Value() (string, error)

Value implements Iterator[T].Value by returning the next line from the reader.

type Iter

type Iter[T any] interface {
	Next() bool
	Value() (T, error)
	Close() error
}

func FromSlice

func FromSlice[T any](items ...T) Iter[T]

type MapIter

type MapIter[T any, R any] struct {
	It     Iter[T]
	Mapper func(t T) (R, error)
}

func (*MapIter[T, R]) Close

func (d *MapIter[T, R]) Close() error

func (*MapIter[T, R]) Next

func (d *MapIter[T, R]) Next() bool

func (*MapIter[T, R]) Value

func (d *MapIter[T, R]) Value() (R, error)

Jump to

Keyboard shortcuts

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