Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iter ¶
type Iter[T any] interface { // Item returns the current item in the iterator. // // Next() must be called before calling Item(). Item() T // Next advances the iterator to the next item and returns true if there is // an item to consume, and false if the end of the input has been reached, // or there has been an error. // // Next must be called before each call to Item. Next() bool // Err returns any error produced while iterating. Err() error }
Iter is a simple interface for iterating across a list of items.
This interface is modeled on the bufio.Scanner behavior.
type IterCloser ¶
IterCloser is an iter, but also embeds the io.Closer interface, so it can be used to wrap a file for iterating through.
func Batch ¶
func Batch[T any](input IterCloser[T], batchSize int) IterCloser[[]T]
func Lines ¶
func Lines(r io.ReadCloser) IterCloser[string]
func Slice ¶
func Slice[T any](slice []T) IterCloser[T]
Click to show internal directories.
Click to hide internal directories.