iterator

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package iterator describes a generic Iterator interface.

Index

Constants

This section is empty.

Variables

View Source
var ErrIteratorDone = errors.New("iterator is read to the end")

ErrIteratorDone is returned when the iterator is read to the end.

Functions

This section is empty.

Types

type Interface

type Interface[K, V any] interface {
	// Next returns the next key/value pair, where the key is a slice index, map key, document number, etc,
	// and the value is the slice or map value, next document, etc.
	// Returned error could be (possibly wrapped) ErrIteratorDone or some fatal error.
	Next() (K, V, error)

	// Close indicates that the iterator will no longer be used.
	// If Close is called, future calls to Next might panic.
	// Close must be concurrency-safe and may be called multiple times.
	// All calls after the first will have no effect.
	Close()
}

Interface is an iterator interface.

Jump to

Keyboard shortcuts

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