orderedmap

package
v1.4.4-alpha1202-loadi... Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0, MIT Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetAny

func SetAny(o *OrderedMap, key any, value any)

Types

type OrderedMap

type OrderedMap struct {
	*OrderedMapEx[string, any]
}

func New

func New(maps ...any) *OrderedMap

New 从零创建一个有序映射或从一个普通映射中创建一个有序映射,其的基本用法与普通映射相同,但内置方法可能不同 值得注意的是,如果传入的是一个普通映射,使用此函数转换为有序映射并不能保证原有的顺序 如果需要保留原有顺序,可以使用 `omap({"a": 1, "b": 2})` 来直接生成一个有序映射 Example: ``` om = orderedmap.New() om["a"] = 1 om.b = 2 println(om.a) // 1 println(om["b"]) // 2 om.Delete("a") om.Delete("b") println(om.a) // nil for i in 100 { om[string(i)] = i } for k, v in om { println(k, v) } ```

func NewOrderMap

func NewOrderMap(key []string, value map[string]any, escapeHTML bool) *OrderedMap

func (*OrderedMap) Copy

func (o *OrderedMap) Copy() *OrderedMap

func (*OrderedMap) Delete

func (o *OrderedMap) Delete(key string) bool

func (*OrderedMap) ForEach

func (o *OrderedMap) ForEach(fn func(key string, value any))

func (OrderedMap) Format

func (o OrderedMap) Format(s fmt.State, verb rune)

func (*OrderedMap) Len

func (o *OrderedMap) Len() int

func (OrderedMap) MarshalJSON

func (o OrderedMap) MarshalJSON() ([]byte, error)

func (OrderedMap) MarshalXML

func (m OrderedMap) MarshalXML(e *yakxml.Encoder, start yakxml.StartElement) error

func (*OrderedMap) Merge

func (o *OrderedMap) Merge(m *OrderedMap)

func (*OrderedMap) MergeStringMap

func (o *OrderedMap) MergeStringMap(m map[string]string)

func (*OrderedMap) Range

func (o *OrderedMap) Range(fn func(key string, value any))

func (*OrderedMap) SetEscapeHTML

func (o *OrderedMap) SetEscapeHTML(on bool)

func (OrderedMap) String

func (o OrderedMap) String() string

func (*OrderedMap) ToAnyMap

func (o *OrderedMap) ToAnyMap() map[any]any

func (*OrderedMap) ToStringMap

func (o *OrderedMap) ToStringMap() map[string]any

func (*OrderedMap) UnmarshalJSON

func (o *OrderedMap) UnmarshalJSON(b []byte) error

func (*OrderedMap) UnmarshalXML

func (o *OrderedMap) UnmarshalXML(d *yakxml.Decoder, start yakxml.StartElement) error

type OrderedMapEx

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

func NewOrderMapEx

func NewOrderMapEx[K comparable, V any](key []K, value map[K]V, escapeHTML bool) *OrderedMapEx[K, V]

func (*OrderedMapEx[K, V]) Copy

func (o *OrderedMapEx[K, V]) Copy() *OrderedMapEx[K, V]

func (*OrderedMapEx[K, V]) Get

func (o *OrderedMapEx[K, V]) Get(key K) (V, bool)

func (*OrderedMapEx[K, V]) GetExact

func (o *OrderedMapEx[K, V]) GetExact(key K) V

func (*OrderedMapEx[K, V]) Keys

func (o *OrderedMapEx[K, V]) Keys() []K

func (*OrderedMapEx[K, V]) Set

func (o *OrderedMapEx[K, V]) Set(key K, value V)

func (*OrderedMapEx[K, V]) Values

func (o *OrderedMapEx[K, V]) Values() []V

Jump to

Keyboard shortcuts

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