jsonmap

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

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

func (*Element) Key

func (e *Element) Key() Key

func (*Element) Next

func (e *Element) Next() *Element

func (*Element) Prev

func (e *Element) Prev() *Element

func (*Element) Value

func (e *Element) Value() Value

type Key

type Key = string

type Map

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

func New

func New() *Map

func (*Map) Clear

func (m *Map) Clear()

func (*Map) Delete

func (m *Map) Delete(key string)

O(n) delete

func (*Map) First

func (m *Map) First() *Element

func (*Map) Get

func (m *Map) Get(key string) (value any, ok bool)

func (*Map) GetElement

func (m *Map) GetElement(key Key) *Element

O(n) for existing keys, because it uses KeyIndex()

func (*Map) KeyIndex

func (m *Map) KeyIndex(key string) int

O(n)

func (*Map) Keys

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

func (*Map) Last

func (m *Map) Last() *Element

func (*Map) Len

func (m *Map) Len() int

func (*Map) MarshalJSON

func (m *Map) MarshalJSON() ([]byte, error)

func (*Map) Merge

func (m *Map) Merge(other *Map)

func (*Map) Push

func (m *Map) Push(key Key, value Value)

Same as Set, but pushes the key to the end O(n) if key exists, as it uses Delete()

func (*Map) PushFront

func (m *Map) PushFront(key Key, value Value)

O(n)

func (*Map) Set

func (m *Map) Set(key Key, value Value)

func (*Map) SetFront

func (m *Map) SetFront(key Key, value Value)

O(n) if key is new

func (*Map) String

func (m *Map) String() string

func (*Map) UnmarshalJSON

func (m *Map) UnmarshalJSON(data []byte) error

func (*Map) Values

func (m *Map) Values() []Value

O(n)

type Value

type Value = any

Jump to

Keyboard shortcuts

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