Documentation ¶
Index ¶
- type OrderedMap
- func (l *OrderedMap) Clear()
- func (l *OrderedMap) Get(key string) (interface{}, bool)
- func (l *OrderedMap) GetOr(key string, defaultValue interface{}) interface{}
- func (l *OrderedMap) Has(key string) bool
- func (l *OrderedMap) Keys() []string
- func (l *OrderedMap) Len() int
- func (l *OrderedMap) MarshalJSON() ([]byte, error)
- func (l *OrderedMap) MarshalYAML() (interface{}, error)
- func (l *OrderedMap) MustGet(key string) interface{}
- func (l *OrderedMap) Remove(key string) (interface{}, bool)
- func (l *OrderedMap) Set(key string, value interface{})
- func (l *OrderedMap) String() string
- func (l *OrderedMap) Values() []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderedMap ¶
type OrderedMap struct {
// contains filtered or unexported fields
}
OrderedMap represents a map which is in ordered. This type is concurrent safe.
func FromInterface ¶
func FromInterface(object interface{}) *OrderedMap
FromInterface creates an OrderedMap from a struct (with json tag), panics if using nil or non-struct object.
func (*OrderedMap) Get ¶
func (l *OrderedMap) Get(key string) (interface{}, bool)
Get returns the value by key, returns false if the key not found.
func (*OrderedMap) GetOr ¶
func (l *OrderedMap) GetOr(key string, defaultValue interface{}) interface{}
GetOr returns the value by key, returns defaultValue if the key not found.
func (*OrderedMap) MarshalJSON ¶
func (l *OrderedMap) MarshalJSON() ([]byte, error)
MarshalJSON marshals OrderedMap to json bytes.
func (*OrderedMap) MarshalYAML ¶
func (l *OrderedMap) MarshalYAML() (interface{}, error)
MarshalYAML marshals OrderedMap to yaml supported object (in no ordered). Details see https://blog.labix.org/2014/09/22/announcing-yaml-v2-for-go and https://github.com/go-yaml/yaml/issues/30#issuecomment-56246239.
func (*OrderedMap) MustGet ¶
func (l *OrderedMap) MustGet(key string) interface{}
MustGet returns the value by key, panics if the key not found.
func (*OrderedMap) Remove ¶
func (l *OrderedMap) Remove(key string) (interface{}, bool)
Remove removes the key-value pair by key, returns false if the key not found.
func (*OrderedMap) Set ¶
func (l *OrderedMap) Set(key string, value interface{})
Set sets a key-value pair, note that it does not change the order for the existed key.
func (*OrderedMap) String ¶
func (l *OrderedMap) String() string
String returns the string in json format.
func (*OrderedMap) Values ¶
func (l *OrderedMap) Values() []interface{}
Values returns the values in ordered.