orderedmap

package
v0.0.0-...-fe5df96 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortStrings

func SortStrings(i string, j string) bool

Types

type Map

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func FromMap

func FromMap[K string, V any](original map[K]V) *Map[K, V]

func New

func New[K comparable, V any]() *Map[K, V]

func (*Map[K, V]) At

func (orderedMap *Map[K, V]) At(index int) V

func (*Map[K, V]) Equal

func (orderedMap *Map[K, V]) Equal(other *Map[K, V]) bool

func (*Map[K, V]) Filter

func (orderedMap *Map[K, V]) Filter(callback func(key K, value V) bool) *Map[K, V]

func (*Map[K, V]) Get

func (orderedMap *Map[K, V]) Get(key K) V

func (*Map[K, V]) Has

func (orderedMap *Map[K, V]) Has(key K) bool

func (*Map[K, V]) Iterate

func (orderedMap *Map[K, V]) Iterate(callback func(key K, value V))

func (*Map[K, V]) Len

func (orderedMap *Map[K, V]) Len() int

func (*Map[K, V]) Map

func (orderedMap *Map[K, V]) Map(callback func(key K, value V) V) *Map[K, V]

func (*Map[K, V]) MarshalJSON

func (orderedMap *Map[K, V]) MarshalJSON() ([]byte, error)

func (*Map[K, V]) Remove

func (orderedMap *Map[K, V]) Remove(key K)

func (*Map[K, V]) Set

func (orderedMap *Map[K, V]) Set(key K, value V)

func (*Map[K, V]) Sort

func (orderedMap *Map[K, V]) Sort(lessFunc func(i K, j K) bool)

Sort sorts the keys using the provided less function, keeping equal elements in their original order.

func (*Map[K, V]) UnmarshalJSON

func (orderedMap *Map[K, V]) UnmarshalJSON(raw []byte) error

FIXME: does not preserve order

type Pair

type Pair[K, V any] struct {
	Key   K
	Value V
}

Jump to

Keyboard shortcuts

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