ordered_map

package
v0.0.92 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map interface {
	Set(key string, val interface{})
	Get(key string) interface{}
	Has(key string) bool
	GetOK(key string) (val interface{}, ok bool)
	Range(fn func(key string, val interface{}) bool)
}

func NewOrderedMap

func NewOrderedMap(opts ...Option) Map

type Option

type Option func(cfg *mapConfig)

func WithCapacity

func WithCapacity(capacity int) Option

type OrderedMap

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

OrderedMap is a map that maintains the order of the keys it is useful for encoding and decoding JSON

func (*OrderedMap) Add

func (c *OrderedMap) Add(key string, val interface{})

func (*OrderedMap) Get

func (c *OrderedMap) Get(key string) interface{}

func (*OrderedMap) GetOK

func (c *OrderedMap) GetOK(key string) (val interface{}, ok bool)

func (*OrderedMap) Has

func (c *OrderedMap) Has(key string) bool

func (*OrderedMap) MarshalJSON

func (c *OrderedMap) MarshalJSON() ([]byte, error)

func (*OrderedMap) Range

func (c *OrderedMap) Range(fn func(key string, val interface{}) bool)

func (*OrderedMap) Set

func (c *OrderedMap) Set(key string, val interface{})

func (*OrderedMap) UnmarshalJSON

func (c *OrderedMap) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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