Documentation
¶
Index ¶
- func SetAny(o *OrderedMap, key any, value any)
- type OrderedMap
- func (o *OrderedMap) Delete(key string) bool
- func (o *OrderedMap) ForEach(fn func(key string, value any))
- func (o OrderedMap) Format(s fmt.State, verb rune)
- func (o *OrderedMap) Get(key string) (any, bool)
- func (o *OrderedMap) Keys() []string
- func (o *OrderedMap) Len() int
- func (o OrderedMap) MarshalJSON() ([]byte, error)
- func (o OrderedMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (o *OrderedMap) Merge(m *OrderedMap)
- func (o *OrderedMap) MergeStringMap(m map[string]string)
- func (o *OrderedMap) Range(fn func(key string, value any))
- func (o *OrderedMap) Set(key string, value any)
- func (o *OrderedMap) SetEscapeHTML(on bool)
- func (o OrderedMap) String() string
- func (o *OrderedMap) ToAnyMap() map[any]any
- func (o *OrderedMap) ToStringMap() map[string]any
- func (o *OrderedMap) UnmarshalJSON(b []byte) error
- func (o *OrderedMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
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 {
// contains filtered or unexported fields
}
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 (*OrderedMap) Delete ¶
func (o *OrderedMap) Delete(key string) bool
func (*OrderedMap) ForEach ¶
func (o *OrderedMap) ForEach(fn func(key string, value any))
func (*OrderedMap) Keys ¶
func (o *OrderedMap) Keys() []string
func (*OrderedMap) Len ¶
func (o *OrderedMap) Len() int
func (OrderedMap) MarshalJSON ¶
func (o OrderedMap) MarshalJSON() ([]byte, error)
func (OrderedMap) MarshalXML ¶
func (o OrderedMap) MarshalXML(e *xml.Encoder, start xml.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) Set ¶
func (o *OrderedMap) Set(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 *xml.Decoder, start xml.StartElement) error
Click to show internal directories.
Click to hide internal directories.