Version: v1.0.2 Latest Latest

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

Go to latest
Published: Mar 29, 2022 License: MIT Imports: 4 Imported by: 10




This section is empty.


This section is empty.


func AsMap

func AsMap(ctx context.Context, s interface{}, v interface{}) error

AsMap returns the values obtained from the source as a map

func Walk

func Walk(ctx context.Context, s Source, v Visitor) error

Walk walks through each element in the map


type Iterator

type Iterator interface {
	Next(context.Context) bool
	Pair() *Pair

Iterator iterates through keys and values of a map

func Iterate

func Iterate(ctx context.Context, m interface{}) (Iterator, error)

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

func New(ch chan *Pair) Iterator

type Pair

type Pair struct {
	Key   interface{}
	Value interface{}

Pair represents a single pair of key and value from a map

type Source

type Source interface {
	Iterate(context.Context) Iterator

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

Jump to

Keyboard shortcuts

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