Documentation ¶
Index ¶
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 an immutable hash map with copy-on-write semantics. Adding to or deleting from the map returns a new map instance. Since the map is immutable, it is safe to use from multiple concurrent threads without locks or other synchronization.
Copying the map is cheap, but since it is a struct, it is not done atomically. To get atomic copying, use atomic.Value.
Map is different from Go map and sync.Map since it safe to copy and is copied by value.
The zero Map is empty and ready for use.
func (Map) Delete ¶
Delete returns a map without entries matching the key. If no entry matches, the original map is returned.
func (*Map) Range ¶
Range calls visitor for each element in the map. If visitor returns false, the iteration stops. Since the map is immutable, it will not change during iteration.