package mapiter
import "github.com/lestrrat-go/iter/mapiter"
Index ¶
- func AsMap(ctx context.Context, s interface{}, v interface{}) error
- func Walk(ctx context.Context, s Source, v Visitor) error
- type Iterator
- type Pair
- type Source
- type Visitor
- type VisitorFunc
Functions ¶
func AsMap ¶
AsMap returns the values obtained from the source as a map
func Walk ¶
Walk walks through each element in the map
Types ¶
type Iterator ¶
Iterator iterates through keys and values of a map
func Iterate ¶
Iterate creates an iterator from arbitrary map types. This is not the most efficient tool, but it's the quickest way to create an iterator for maps. Also, note that you cannot make any assumptions on the order of pairs being returned.
func New ¶
type Pair ¶
type Pair struct { Key interface{} Value interface{} }
Pair represents a single pair of key and value from a map
type Source ¶
Source represents a map that knows how to create an iterator
type Visitor ¶
type Visitor interface { Visit(interface{}, interface{}) error }
Visitor represents an object that handles each pair in a map
type VisitorFunc ¶
type VisitorFunc func(interface{}, interface{}) error
VisitorFunc is a type of Visitor based on a function
func (VisitorFunc) Visit ¶
func (fn VisitorFunc) Visit(s interface{}, v interface{}) error
Source Files ¶
- Version
- v1.0.2 (latest)
- Published
- Mar 29, 2022
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 3 weeks ago –
Tools for package owners.