ziter

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValueNotSlice = errors.New("value is not a slice")
)

Functions

func InterfaceToSlice

func InterfaceToSlice(input interface{}) (slice []interface{}, err error)

Convert interface{} into []interface{} if the input is a slice, otherwise, return an error.

func IteratorChunk added in v0.9.21

func IteratorChunk[T any](iterator Iterator[T], size int, handler ChunkHandler[T]) (err error)

func NewSliceIterator added in v0.9.21

func NewSliceIterator[T any](slice []T) *sliceIterator[T]

func SliceChunks added in v0.9.21

func SliceChunks[T any](items []T, size int, handler ChunkHandler[T]) (err error)

Break a slice into multiple slices of the provided size

Types

type ChunkHandler

type ChunkHandler[T any] func(chunk []T) error

type Iterator added in v0.9.21

type Iterator[T any] interface {
	Next() bool
	Item() T
	Err() error
}

Jump to

Keyboard shortcuts

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