Documentation
¶
Index ¶
- type Map
- func (m *Map) Capacity() int
- func (m *Map) Clear()
- func (m *Map) Clone() *Map
- func (m *Map) Count() int
- func (m *Map) Delete(key uint32)
- func (m *Map) Load(key uint32) (uint32, bool)
- func (m *Map) Range(fn func(key, val uint32) bool)
- func (m *Map) RangeEach(fn func(key, val uint32))
- func (m *Map) RangeErr(fn func(key, val uint32) error) error
- func (m *Map) Store(key, val uint32)
- type Sync
- func (m *Sync) Count() (count int)
- func (m *Sync) Delete(key uint32)
- func (m *Sync) Load(key uint32) (value uint32, ok bool)
- func (m *Sync) LoadOrStore(key uint32, fn func() uint32) (value uint32, loaded bool)
- func (m *Sync) Range(f func(key, value uint32) bool)
- func (m *Sync) Store(key, val uint32)
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 contiguous hash table with interleaved key/value slots.
func NewWithFill ¶ added in v1.5.0
New allocates a map sized for at least `size` entries.
func (*Map) Capacity ¶ added in v1.4.1
Capacity returns the maximum number of entries before resize.
func (*Map) Clear ¶ added in v1.4.0
func (m *Map) Clear()
Clear removes all key/value pairs from the map.
func (*Map) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*Map) RangeEach ¶ added in v1.3.0
RangeEach visits every key/value pair without early‑exit capability.
type Sync ¶ added in v1.1.0
type Sync struct {
// contains filtered or unexported fields
}
Sync is a thread-safe, map-like data-structure for int64s
func NewSync ¶ added in v1.1.0
NewSync returns a thread-safe map initialized with n spaces and uses the stated fillFactor. The map will grow as needed.
func NewSyncWithFill ¶ added in v1.5.0
NewSyncWithFill returns a thread-safe map initialized with n spaces and uses the stated fillFactor. The map will grow as needed.
func (*Sync) Load ¶ added in v1.1.0
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*Sync) LoadOrStore ¶ added in v1.1.0
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value returned by the handler. The loaded result is true if the value was loaded, false if stored.