Documentation ¶
Index ¶
- type Map
- func (m *Map) Add(key string, value interface{}) bool
- func (m *Map) Get(key string) (interface{}, bool)
- func (m *Map) GetAll() []interface{}
- func (m *Map) GetAllKeys() []string
- func (m *Map) GetOrAdd(key string, value interface{}) (interface{}, bool)
- func (m *Map) Len() int
- func (m *Map) Remove(key string) (interface{}, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a concurrency safe hash map
func (*Map) Add ¶
Add inserts the key value pair to the map. If there is already a mapping it will be overwritten by the new value. It returns true if there was not yet a mapping.
func (*Map) Get ¶
Get returns if the key is present the value associated with it from the map and true. Otherwise the value type's zero value and false is returned
func (*Map) GetOrAdd ¶
GetOrAdd only inserts the key value pair to Map if there has not yet been a mapping for key. It first returns the already existing value associated with the key or otherwise the new value. The second return value is a boolean value which is true if the mapping has not yet been present.