maps

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Key string
	Val any
}

Go channels can onlt emit a single value

type Map

type Map struct {
	// contains filtered or unexported fields
}

Go maps are not ordered by insertion

func New

func New(values ...any) *Map

Convenience func to create a Map out of values

func (*Map) Get

func (me *Map) Get(key string) any

Retrieves a value for a key

func (*Map) Index

func (me *Map) Index(key string) int

Returns the position of a key in the list

func (*Map) Items

func (me *Map) Items() chan *Item

Returns a channel iterator over the values

func (*Map) Iter

func (me *Map) Iter() func(func(string, any) bool)

This new range over anything requires go 1.23+.

func (*Map) Keys

func (me *Map) Keys() []string

Returns all the keys

func (*Map) Len

func (me *Map) Len() int

Returns the lenght of they keys

func (*Map) Set

func (me *Map) Set(key string, val any) *Map

Sets a value for a key

Jump to

Keyboard shortcuts

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