gmap

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package gmap provides kinds of concurrent-safe(alternative) maps.

并发安全MAP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntBoolMap added in v1.5.0

type IntBoolMap struct {
	// contains filtered or unexported fields
}

func NewIntBoolMap added in v1.5.0

func NewIntBoolMap(unsafe ...bool) *IntBoolMap

func NewIntBoolMapFrom added in v1.5.0

func NewIntBoolMapFrom(m map[int]bool, unsafe ...bool) *IntBoolMap

func NewIntBoolMapFromArray added in v1.5.0

func NewIntBoolMapFromArray(keys []int, values []bool, unsafe ...bool) *IntBoolMap

func (*IntBoolMap) BatchRemove added in v1.5.0

func (gm *IntBoolMap) BatchRemove(keys []int)

批量删除键值对

func (*IntBoolMap) BatchSet added in v1.5.0

func (gm *IntBoolMap) BatchSet(m map[int]bool)

批量设置键值对

func (*IntBoolMap) Clear added in v1.5.0

func (gm *IntBoolMap) Clear()

清空哈希表

func (*IntBoolMap) Clone added in v1.5.0

func (gm *IntBoolMap) Clone() *IntBoolMap

哈希表克隆.

func (*IntBoolMap) Contains added in v1.5.0

func (gm *IntBoolMap) Contains(key int) bool

是否存在某个键

func (*IntBoolMap) Get added in v1.5.0

func (gm *IntBoolMap) Get(key int) bool

获取键值

func (*IntBoolMap) GetOrSet added in v1.5.0

func (gm *IntBoolMap) GetOrSet(key int, value bool) bool

当键名存在时返回其键值,否则写入指定的键值

func (*IntBoolMap) GetOrSetFunc added in v1.5.0

func (gm *IntBoolMap) GetOrSetFunc(key int, f func() bool) bool

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*IntBoolMap) GetOrSetFuncLock added in v1.5.0

func (gm *IntBoolMap) GetOrSetFuncLock(key int, f func() bool) bool

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*IntBoolMap) IsEmpty added in v1.5.0

func (gm *IntBoolMap) IsEmpty() bool

哈希表是否为空

func (*IntBoolMap) Iterator added in v1.5.0

func (gm *IntBoolMap) Iterator(f func(k int, v bool) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*IntBoolMap) Keys added in v1.5.0

func (gm *IntBoolMap) Keys() []int

返回键列表

func (*IntBoolMap) LockFunc added in v1.5.0

func (gm *IntBoolMap) LockFunc(f func(m map[int]bool))

并发安全锁操作,使用自定义方法执行加锁修改操作

func (*IntBoolMap) Map added in v1.5.0

func (gm *IntBoolMap) Map() map[int]bool

返回当前哈希表的数据Map.

func (*IntBoolMap) Merge added in v1.5.0

func (gm *IntBoolMap) Merge(m *IntBoolMap)

合并两个Map.

func (*IntBoolMap) RLockFunc added in v1.5.0

func (gm *IntBoolMap) RLockFunc(f func(m map[int]bool))

并发安全锁操作,使用自定义方法执行加锁读取操作

func (*IntBoolMap) Remove added in v1.5.0

func (gm *IntBoolMap) Remove(key int) bool

返回对应的键值,并删除该键值

func (*IntBoolMap) Set added in v1.5.0

func (gm *IntBoolMap) Set(key int, val bool)

设置键值对

func (*IntBoolMap) SetIfNotExist added in v1.5.0

func (gm *IntBoolMap) SetIfNotExist(key int, value bool) bool

当键名不存在时写入,并返回true;否则返回false。

func (*IntBoolMap) Size added in v1.5.0

func (gm *IntBoolMap) Size() int

哈希表大小

type IntIntMap

type IntIntMap struct {
	// contains filtered or unexported fields
}

func NewIntIntMap

func NewIntIntMap(unsafe ...bool) *IntIntMap

func NewIntIntMapFrom

func NewIntIntMapFrom(m map[int]int, unsafe ...bool) *IntIntMap

func NewIntIntMapFromArray added in v1.5.0

func NewIntIntMapFromArray(keys []int, values []int, unsafe ...bool) *IntIntMap

func (*IntIntMap) BatchRemove added in v1.5.0

func (gm *IntIntMap) BatchRemove(keys []int)

批量删除键值对

func (*IntIntMap) BatchSet added in v1.5.0

func (gm *IntIntMap) BatchSet(m map[int]int)

批量设置键值对

func (*IntIntMap) Clear

func (gm *IntIntMap) Clear()

清空哈希表

func (*IntIntMap) Clone

func (gm *IntIntMap) Clone() *IntIntMap

哈希表克隆.

func (*IntIntMap) Contains

func (gm *IntIntMap) Contains(key int) bool

是否存在某个键

func (*IntIntMap) Flip

func (gm *IntIntMap) Flip()

交换Map中的键和值.

func (*IntIntMap) Get

func (gm *IntIntMap) Get(key int) int

获取键值

func (*IntIntMap) GetOrSet

func (gm *IntIntMap) GetOrSet(key int, value int) int

当键名存在时返回其键值,否则写入指定的键值

func (*IntIntMap) GetOrSetFunc

func (gm *IntIntMap) GetOrSetFunc(key int, f func() int) int

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*IntIntMap) GetOrSetFuncLock

func (gm *IntIntMap) GetOrSetFuncLock(key int, f func() int) int

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*IntIntMap) IsEmpty

func (gm *IntIntMap) IsEmpty() bool

哈希表是否为空

func (*IntIntMap) Iterator

func (gm *IntIntMap) Iterator(f func(k int, v int) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*IntIntMap) Keys

func (gm *IntIntMap) Keys() []int

返回键列表

func (*IntIntMap) LockFunc

func (gm *IntIntMap) LockFunc(f func(m map[int]int))

并发安全锁操作,使用自定义方法执行加锁修改操作

func (*IntIntMap) Map

func (gm *IntIntMap) Map() map[int]int

返回当前哈希表的数据Map.

func (*IntIntMap) Merge

func (gm *IntIntMap) Merge(m *IntIntMap)

合并两个Map.

func (*IntIntMap) RLockFunc

func (gm *IntIntMap) RLockFunc(f func(m map[int]int))

并发安全锁操作,使用自定义方法执行加锁读取操作

func (*IntIntMap) Remove

func (gm *IntIntMap) Remove(key int) int

返回对应的键值,并删除该键值

func (*IntIntMap) Set

func (gm *IntIntMap) Set(key int, val int)

设置键值对

func (*IntIntMap) SetIfNotExist

func (gm *IntIntMap) SetIfNotExist(key int, value int) bool

当键名不存在时写入,并返回true;否则返回false。

func (*IntIntMap) Size

func (gm *IntIntMap) Size() int

哈希表大小

func (*IntIntMap) Values

func (gm *IntIntMap) Values() []int

返回值列表(注意是随机排序)

type IntInterfaceMap added in v1.5.0

type IntInterfaceMap struct {
	// contains filtered or unexported fields
}

func NewIntInterfaceMap added in v1.5.0

func NewIntInterfaceMap(unsafe ...bool) *IntInterfaceMap

func NewIntInterfaceMapFrom added in v1.5.0

func NewIntInterfaceMapFrom(m map[int]interface{}, unsafe ...bool) *IntInterfaceMap

func NewIntInterfaceMapFromArray added in v1.5.0

func NewIntInterfaceMapFromArray(keys []int, values []interface{}, unsafe ...bool) *IntInterfaceMap

func (*IntInterfaceMap) BatchRemove added in v1.5.0

func (gm *IntInterfaceMap) BatchRemove(keys []int)

批量删除键值对

func (*IntInterfaceMap) BatchSet added in v1.5.0

func (gm *IntInterfaceMap) BatchSet(m map[int]interface{})

批量设置键值对

func (*IntInterfaceMap) Clear added in v1.5.0

func (gm *IntInterfaceMap) Clear()

清空哈希表

func (*IntInterfaceMap) Clone added in v1.5.0

func (gm *IntInterfaceMap) Clone() *IntInterfaceMap

哈希表克隆.

func (*IntInterfaceMap) Contains added in v1.5.0

func (gm *IntInterfaceMap) Contains(key int) bool

是否存在某个键

func (*IntInterfaceMap) Flip added in v1.5.0

func (gm *IntInterfaceMap) Flip()

交换Map中的键和值.

func (*IntInterfaceMap) Get added in v1.5.0

func (gm *IntInterfaceMap) Get(key int) interface{}

获取键值

func (*IntInterfaceMap) GetOrSet added in v1.5.0

func (gm *IntInterfaceMap) GetOrSet(key int, value interface{}) interface{}

当键名存在时返回其键值,否则写入指定的键值

func (*IntInterfaceMap) GetOrSetFunc added in v1.5.0

func (gm *IntInterfaceMap) GetOrSetFunc(key int, f func() interface{}) interface{}

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*IntInterfaceMap) GetOrSetFuncLock added in v1.5.0

func (gm *IntInterfaceMap) GetOrSetFuncLock(key int, f func() interface{}) interface{}

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*IntInterfaceMap) IsEmpty added in v1.5.0

func (gm *IntInterfaceMap) IsEmpty() bool

哈希表是否为空

func (*IntInterfaceMap) Iterator added in v1.5.0

func (gm *IntInterfaceMap) Iterator(f func(k int, v interface{}) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*IntInterfaceMap) Keys added in v1.5.0

func (gm *IntInterfaceMap) Keys() []int

返回键列表

func (*IntInterfaceMap) LockFunc added in v1.5.0

func (gm *IntInterfaceMap) LockFunc(f func(m map[int]interface{}))

并发安全锁操作,使用自定义方法执行加锁修改操作

func (*IntInterfaceMap) Map added in v1.5.0

func (gm *IntInterfaceMap) Map() map[int]interface{}

返回当前哈希表的数据Map.

func (*IntInterfaceMap) Merge added in v1.5.0

func (gm *IntInterfaceMap) Merge(m *IntInterfaceMap)

合并两个Map.

func (*IntInterfaceMap) RLockFunc added in v1.5.0

func (gm *IntInterfaceMap) RLockFunc(f func(m map[int]interface{}))

并发安全锁操作,使用自定义方法执行加锁读取操作

func (*IntInterfaceMap) Remove added in v1.5.0

func (gm *IntInterfaceMap) Remove(key int) interface{}

返回对应的键值,并删除该键值

func (*IntInterfaceMap) Set added in v1.5.0

func (gm *IntInterfaceMap) Set(key int, val interface{})

设置键值对

func (*IntInterfaceMap) SetIfNotExist added in v1.5.0

func (gm *IntInterfaceMap) SetIfNotExist(key int, value interface{}) bool

当键名不存在时写入,并返回true;否则返回false。

func (*IntInterfaceMap) Size added in v1.5.0

func (gm *IntInterfaceMap) Size() int

哈希表大小

func (*IntInterfaceMap) Values added in v1.5.0

func (gm *IntInterfaceMap) Values() []interface{}

返回值列表(注意是随机排序)

type IntStringMap added in v1.5.0

type IntStringMap struct {
	// contains filtered or unexported fields
}

func NewIntStringMap added in v1.5.0

func NewIntStringMap(unsafe ...bool) *IntStringMap

func NewIntStringMapFrom added in v1.5.0

func NewIntStringMapFrom(m map[int]string, unsafe ...bool) *IntStringMap

func NewIntStringMapFromArray added in v1.5.0

func NewIntStringMapFromArray(keys []int, values []string, unsafe ...bool) *IntStringMap

func (*IntStringMap) BatchRemove added in v1.5.0

func (gm *IntStringMap) BatchRemove(keys []int)

批量删除键值对

func (*IntStringMap) BatchSet added in v1.5.0

func (gm *IntStringMap) BatchSet(m map[int]string)

批量设置键值对

func (*IntStringMap) Clear added in v1.5.0

func (gm *IntStringMap) Clear()

清空哈希表

func (*IntStringMap) Clone added in v1.5.0

func (gm *IntStringMap) Clone() *IntStringMap

哈希表克隆.

func (*IntStringMap) Contains added in v1.5.0

func (gm *IntStringMap) Contains(key int) bool

是否存在某个键

func (*IntStringMap) Flip added in v1.5.0

func (gm *IntStringMap) Flip()

交换Map中的键和值.

func (*IntStringMap) Get added in v1.5.0

func (gm *IntStringMap) Get(key int) string

获取键值

func (*IntStringMap) GetOrSet added in v1.5.0

func (gm *IntStringMap) GetOrSet(key int, value string) string

当键名存在时返回其键值,否则写入指定的键值

func (*IntStringMap) GetOrSetFunc added in v1.5.0

func (gm *IntStringMap) GetOrSetFunc(key int, f func() string) string

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*IntStringMap) GetOrSetFuncLock added in v1.5.0

func (gm *IntStringMap) GetOrSetFuncLock(key int, f func() string) string

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*IntStringMap) IsEmpty added in v1.5.0

func (gm *IntStringMap) IsEmpty() bool

哈希表是否为空

func (*IntStringMap) Iterator added in v1.5.0

func (gm *IntStringMap) Iterator(f func(k int, v string) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*IntStringMap) Keys added in v1.5.0

func (gm *IntStringMap) Keys() []int

返回键列表

func (*IntStringMap) LockFunc added in v1.5.0

func (gm *IntStringMap) LockFunc(f func(m map[int]string))

并发安全锁操作,使用自定义方法执行加锁修改操作

func (*IntStringMap) Map added in v1.5.0

func (gm *IntStringMap) Map() map[int]string

返回当前哈希表的数据Map.

func (*IntStringMap) Merge added in v1.5.0

func (gm *IntStringMap) Merge(m *IntStringMap)

合并两个Map.

func (*IntStringMap) RLockFunc added in v1.5.0

func (gm *IntStringMap) RLockFunc(f func(m map[int]string))

并发安全锁操作,使用自定义方法执行加锁读取操作

func (*IntStringMap) Remove added in v1.5.0

func (gm *IntStringMap) Remove(key int) string

返回对应的键值,并删除该键值

func (*IntStringMap) Set added in v1.5.0

func (gm *IntStringMap) Set(key int, val string)

设置键值对

func (*IntStringMap) SetIfNotExist added in v1.5.0

func (gm *IntStringMap) SetIfNotExist(key int, value string) bool

当键名不存在时写入,并返回true;否则返回false。

func (*IntStringMap) Size added in v1.5.0

func (gm *IntStringMap) Size() int

哈希表大小

func (*IntStringMap) Values added in v1.5.0

func (gm *IntStringMap) Values() []string

返回值列表(注意是随机排序)

type Map

type Map struct {
	// contains filtered or unexported fields
}

注意: 1、这个Map是所有并发安全Map中效率最低的,如果对效率要求比较高的场合,请合理选择对应数据类型的Map; 2、这个Map的优点是使用简便,由于键值都是interface{}类型,因此对键值的数据类型要求不高; 3、底层实现比较类似于sync.Map;

func New

func New(unsafe ...bool) *Map

Create an empty hash map. The param <unsafe> used to specify whether using map with un-concurrent-safety, which is false in default, means concurrent-safe in default.

创建一个空的哈希表,参数unsafe用于指定是否用于非并发安全场景,默认为false,表示并发安全。

func NewFrom

func NewFrom(m map[interface{}]interface{}, unsafe ...bool) *Map

Create a hash map from given map. Be aware that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

基于给定的map变量创建哈希表对象,注意由于map是指针类型,外部对map有操作时会有并发安全问题。

func NewFromArray added in v1.5.0

func NewFromArray(keys []interface{}, values []interface{}, unsafe ...bool) *Map

Create a hash map from given arrays. The param <keys> given as the keys of the map, and <values> as the corresponding values.

基于给定的数组变量创建哈希表对象,keys作为键名, values作为键值。 当keys数组大小比values数组大时,多余的键名将会使用对应类型默认的键值。

func NewMap added in v1.5.0

func NewMap(unsafe ...bool) *Map

See New.

同New方法。

func (*Map) BatchRemove added in v1.5.0

func (gm *Map) BatchRemove(keys []interface{})

Batch remove by keys.

批量删除键值对

func (*Map) BatchSet added in v1.5.0

func (gm *Map) BatchSet(m map[interface{}]interface{})

Batch set key-values to the hash map.

批量设置键值对

func (*Map) Clear added in v1.5.0

func (gm *Map) Clear()

Clear the hash map, it will remake a new underlying map data map.

清空哈希表

func (*Map) Clone added in v1.5.0

func (gm *Map) Clone() *Map

Clone current hash map with copy of underlying data, return a new hash map.

哈希表克隆.

func (*Map) Contains added in v1.5.0

func (gm *Map) Contains(key interface{}) bool

Check whether a key exist.

是否存在某个键

func (*Map) Flip added in v1.5.0

func (gm *Map) Flip()

Exchange key-value in the hash map, it will change key-value to value-key.

交换Map中的键和值.

func (*Map) Get added in v1.5.0

func (gm *Map) Get(key interface{}) interface{}

Get value by key.

获取键值

func (*Map) GetOrSet added in v1.5.0

func (gm *Map) GetOrSet(key interface{}, value interface{}) interface{}

Get the value by key, or set it with given key-value if not exist.

当键名存在时返回其键值,否则写入指定的键值

func (*Map) GetOrSetFunc added in v1.5.0

func (gm *Map) GetOrSetFunc(key interface{}, f func() interface{}) interface{}

Get the value by key, or set the it with return of callback function <f> if not exist.

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*Map) GetOrSetFuncLock added in v1.5.0

func (gm *Map) GetOrSetFuncLock(key interface{}, f func() interface{}) interface{}

Get the value by key, or set the it with return of callback function <f> if not exist. The difference with GetOrSetFunc is, it locks in executing callback function <f>.

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*Map) IsEmpty added in v1.5.0

func (gm *Map) IsEmpty() bool

Check whether the hash map is empty.

哈希表是否为空

func (*Map) Iterator added in v1.5.0

func (gm *Map) Iterator(f func(k interface{}, v interface{}) bool)

Iterate the hash map with custom callback function <f>. If f returns true, then continue iterating; or false to stop.

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*Map) Keys added in v1.5.0

func (gm *Map) Keys() []interface{}

Return all the keys of hash map as a slice.

返回键列表.

func (*Map) LockFunc added in v1.5.0

func (gm *Map) LockFunc(f func(m map[interface{}]interface{}))

Lock writing with given callback <f>.

并发安全锁操作,使用自定义方法执行加锁修改操作

func (*Map) Map added in v1.5.0

func (gm *Map) Map() map[interface{}]interface{}

Returns copy of the data of the hash map.

返回当前哈希表的数据Map.

func (*Map) Merge added in v1.5.0

func (gm *Map) Merge(m *Map)

Merge two hash maps.

合并两个Map.

func (*Map) RLockFunc added in v1.5.0

func (gm *Map) RLockFunc(f func(m map[interface{}]interface{}))

Lock reading with given callback <f>.

并发安全锁操作,使用自定义方法执行加锁读取操作

func (*Map) Remove added in v1.5.0

func (gm *Map) Remove(key interface{}) interface{}

Remove by given key.

返回对应的键值,并删除该键值

func (*Map) Set added in v1.5.0

func (gm *Map) Set(key interface{}, val interface{})

Set key-value to the hash map.

设置键值对

func (*Map) SetIfNotExist added in v1.5.0

func (gm *Map) SetIfNotExist(key interface{}, value interface{}) bool

Set key-value if the key does not exist, then return true; or else return false.

当键名不存在时写入,并返回true;否则返回false。

func (*Map) Size added in v1.5.0

func (gm *Map) Size() int

Get the size of hash map.

哈希表大小

func (*Map) Values added in v1.5.0

func (gm *Map) Values() []interface{}

Return all the values of hash map as a slice.

返回值列表(注意是随机排序)

type StringBoolMap added in v1.5.0

type StringBoolMap struct {
	// contains filtered or unexported fields
}

func NewStringBoolMap added in v1.5.0

func NewStringBoolMap(unsafe ...bool) *StringBoolMap

func NewStringBoolMapFrom added in v1.5.0

func NewStringBoolMapFrom(m map[string]bool, unsafe ...bool) *StringBoolMap

func NewStringBoolMapFromArray added in v1.5.0

func NewStringBoolMapFromArray(keys []string, values []bool, unsafe ...bool) *StringBoolMap

func (*StringBoolMap) BatchRemove added in v1.5.0

func (gm *StringBoolMap) BatchRemove(keys []string)

批量删除键值对

func (*StringBoolMap) BatchSet added in v1.5.0

func (gm *StringBoolMap) BatchSet(m map[string]bool)

批量设置键值对

func (*StringBoolMap) Clear added in v1.5.0

func (gm *StringBoolMap) Clear()

清空哈希表

func (*StringBoolMap) Clone added in v1.5.0

func (gm *StringBoolMap) Clone() *StringBoolMap

哈希表克隆.

func (*StringBoolMap) Contains added in v1.5.0

func (gm *StringBoolMap) Contains(key string) bool

是否存在某个键

func (*StringBoolMap) Get added in v1.5.0

func (gm *StringBoolMap) Get(key string) bool

获取键值

func (*StringBoolMap) GetOrSet added in v1.5.0

func (gm *StringBoolMap) GetOrSet(key string, value bool) bool

当键名存在时返回其键值,否则写入指定的键值

func (*StringBoolMap) GetOrSetFunc added in v1.5.0

func (gm *StringBoolMap) GetOrSetFunc(key string, f func() bool) bool

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*StringBoolMap) GetOrSetFuncLock added in v1.5.0

func (gm *StringBoolMap) GetOrSetFuncLock(key string, f func() bool) bool

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*StringBoolMap) IsEmpty added in v1.5.0

func (gm *StringBoolMap) IsEmpty() bool

哈希表是否为空

func (*StringBoolMap) Iterator added in v1.5.0

func (gm *StringBoolMap) Iterator(f func(k string, v bool) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*StringBoolMap) Keys added in v1.5.0

func (gm *StringBoolMap) Keys() []string

返回键列表

func (*StringBoolMap) LockFunc added in v1.5.0

func (gm *StringBoolMap) LockFunc(f func(m map[string]bool))

并发安全锁操作,使用自定义方法执行加锁修改操作

func (*StringBoolMap) Map added in v1.5.0

func (gm *StringBoolMap) Map() map[string]bool

返回当前哈希表的数据Map.

func (*StringBoolMap) Merge added in v1.5.0

func (gm *StringBoolMap) Merge(m *StringBoolMap)

合并两个Map.

func (*StringBoolMap) RLockFunc added in v1.5.0

func (gm *StringBoolMap) RLockFunc(f func(m map[string]bool))

并发安全锁操作,使用自定义方法执行加锁读取操作

func (*StringBoolMap) Remove added in v1.5.0

func (gm *StringBoolMap) Remove(key string) bool

返回对应的键值,并删除该键值

func (*StringBoolMap) Set added in v1.5.0

func (gm *StringBoolMap) Set(key string, val bool)

设置键值对

func (*StringBoolMap) SetIfNotExist added in v1.5.0

func (gm *StringBoolMap) SetIfNotExist(key string, value bool) bool

当键名不存在时写入,并返回true;否则返回false。

func (*StringBoolMap) Size added in v1.5.0

func (gm *StringBoolMap) Size() int

哈希表大小

type StringIntMap added in v1.5.0

type StringIntMap struct {
	// contains filtered or unexported fields
}

func NewStringIntMap added in v1.5.0

func NewStringIntMap(unsafe ...bool) *StringIntMap

func NewStringIntMapFrom added in v1.5.0

func NewStringIntMapFrom(m map[string]int, unsafe ...bool) *StringIntMap

func NewStringIntMapFromArray added in v1.5.0

func NewStringIntMapFromArray(keys []string, values []int, unsafe ...bool) *StringIntMap

func (*StringIntMap) BatchRemove added in v1.5.0

func (gm *StringIntMap) BatchRemove(keys []string)

批量删除键值对

func (*StringIntMap) BatchSet added in v1.5.0

func (gm *StringIntMap) BatchSet(m map[string]int)

批量设置键值对

func (*StringIntMap) Clear added in v1.5.0

func (gm *StringIntMap) Clear()

清空哈希表

func (*StringIntMap) Clone added in v1.5.0

func (gm *StringIntMap) Clone() *StringIntMap

哈希表克隆.

func (*StringIntMap) Contains added in v1.5.0

func (gm *StringIntMap) Contains(key string) bool

是否存在某个键

func (*StringIntMap) Flip added in v1.5.0

func (gm *StringIntMap) Flip()

交换Map中的键和值.

func (*StringIntMap) Get added in v1.5.0

func (gm *StringIntMap) Get(key string) int

获取键值

func (*StringIntMap) GetOrSet added in v1.5.0

func (gm *StringIntMap) GetOrSet(key string, value int) int

当键名存在时返回其键值,否则写入指定的键值

func (*StringIntMap) GetOrSetFunc added in v1.5.0

func (gm *StringIntMap) GetOrSetFunc(key string, f func() int) int

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*StringIntMap) GetOrSetFuncLock added in v1.5.0

func (gm *StringIntMap) GetOrSetFuncLock(key string, f func() int) int

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*StringIntMap) IsEmpty added in v1.5.0

func (gm *StringIntMap) IsEmpty() bool

哈希表是否为空

func (*StringIntMap) Iterator added in v1.5.0

func (gm *StringIntMap) Iterator(f func(k string, v int) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*StringIntMap) Keys added in v1.5.0

func (gm *StringIntMap) Keys() []string

返回键列表

func (*StringIntMap) LockFunc added in v1.5.0

func (gm *StringIntMap) LockFunc(f func(m map[string]int))

并发安全写锁操作,使用自定义方法执行加锁修改操作

func (*StringIntMap) Map added in v1.5.0

func (gm *StringIntMap) Map() map[string]int

返回当前哈希表的数据Map.

func (*StringIntMap) Merge added in v1.5.0

func (gm *StringIntMap) Merge(m *StringIntMap)

合并两个Map.

func (*StringIntMap) RLockFunc added in v1.5.0

func (gm *StringIntMap) RLockFunc(f func(m map[string]int))

并发安全读锁操作,使用自定义方法执行加锁读取操作

func (*StringIntMap) Remove added in v1.5.0

func (gm *StringIntMap) Remove(key string) int

返回对应的键值,并删除该键值

func (*StringIntMap) Set added in v1.5.0

func (gm *StringIntMap) Set(key string, val int)

设置键值对

func (*StringIntMap) SetIfNotExist added in v1.5.0

func (gm *StringIntMap) SetIfNotExist(key string, value int) bool

当键名不存在时写入,并返回true;否则返回false。

func (*StringIntMap) Size added in v1.5.0

func (gm *StringIntMap) Size() int

哈希表大小

func (*StringIntMap) Values added in v1.5.0

func (gm *StringIntMap) Values() []int

返回值列表(注意是随机排序)

type StringInterfaceMap added in v1.5.0

type StringInterfaceMap struct {
	// contains filtered or unexported fields
}

func NewStringInterfaceMap added in v1.5.0

func NewStringInterfaceMap(unsafe ...bool) *StringInterfaceMap

func NewStringInterfaceMapFrom added in v1.5.0

func NewStringInterfaceMapFrom(m map[string]interface{}, unsafe ...bool) *StringInterfaceMap

func NewStringInterfaceMapFromArray added in v1.5.0

func NewStringInterfaceMapFromArray(keys []string, values []interface{}, unsafe ...bool) *StringInterfaceMap

func (*StringInterfaceMap) BatchRemove added in v1.5.0

func (gm *StringInterfaceMap) BatchRemove(keys []string)

批量删除键值对

func (*StringInterfaceMap) BatchSet added in v1.5.0

func (gm *StringInterfaceMap) BatchSet(m map[string]interface{})

批量设置键值对

func (*StringInterfaceMap) Clear added in v1.5.0

func (gm *StringInterfaceMap) Clear()

清空哈希表

func (*StringInterfaceMap) Clone added in v1.5.0

哈希表克隆.

func (*StringInterfaceMap) Contains added in v1.5.0

func (gm *StringInterfaceMap) Contains(key string) bool

是否存在某个键

func (*StringInterfaceMap) Flip added in v1.5.0

func (gm *StringInterfaceMap) Flip()

交换Map中的键和值.

func (*StringInterfaceMap) Get added in v1.5.0

func (gm *StringInterfaceMap) Get(key string) interface{}

获取键值

func (*StringInterfaceMap) GetOrSet added in v1.5.0

func (gm *StringInterfaceMap) GetOrSet(key string, value interface{}) interface{}

当键名存在时返回其键值,否则写入指定的键值

func (*StringInterfaceMap) GetOrSetFunc added in v1.5.0

func (gm *StringInterfaceMap) GetOrSetFunc(key string, f func() interface{}) interface{}

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*StringInterfaceMap) GetOrSetFuncLock added in v1.5.0

func (gm *StringInterfaceMap) GetOrSetFuncLock(key string, f func() interface{}) interface{}

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*StringInterfaceMap) IsEmpty added in v1.5.0

func (gm *StringInterfaceMap) IsEmpty() bool

哈希表是否为空

func (*StringInterfaceMap) Iterator added in v1.5.0

func (gm *StringInterfaceMap) Iterator(f func(k string, v interface{}) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*StringInterfaceMap) Keys added in v1.5.0

func (gm *StringInterfaceMap) Keys() []string

返回键列表

func (*StringInterfaceMap) LockFunc added in v1.5.0

func (gm *StringInterfaceMap) LockFunc(f func(m map[string]interface{}))

并发安全写锁操作,使用自定义方法执行加锁修改操作

func (*StringInterfaceMap) Map added in v1.5.0

func (gm *StringInterfaceMap) Map() map[string]interface{}

返回当前哈希表的数据Map.

func (*StringInterfaceMap) Merge added in v1.5.0

func (gm *StringInterfaceMap) Merge(m *StringInterfaceMap)

合并两个Map.

func (*StringInterfaceMap) RLockFunc added in v1.5.0

func (gm *StringInterfaceMap) RLockFunc(f func(m map[string]interface{}))

并发安全读锁操作,使用自定义方法执行加锁读取操作

func (*StringInterfaceMap) Remove added in v1.5.0

func (gm *StringInterfaceMap) Remove(key string) interface{}

返回对应的键值,并删除该键值

func (*StringInterfaceMap) Set added in v1.5.0

func (gm *StringInterfaceMap) Set(key string, val interface{})

设置键值对

func (*StringInterfaceMap) SetIfNotExist added in v1.5.0

func (gm *StringInterfaceMap) SetIfNotExist(key string, value interface{}) bool

当键名不存在时写入,并返回true;否则返回false。

func (*StringInterfaceMap) Size added in v1.5.0

func (gm *StringInterfaceMap) Size() int

哈希表大小

func (*StringInterfaceMap) Values added in v1.5.0

func (gm *StringInterfaceMap) Values() []interface{}

返回值列表(注意是随机排序)

type StringStringMap added in v1.5.0

type StringStringMap struct {
	// contains filtered or unexported fields
}

func NewStringStringMap added in v1.5.0

func NewStringStringMap(unsafe ...bool) *StringStringMap

func NewStringStringMapFrom added in v1.5.0

func NewStringStringMapFrom(m map[string]string, unsafe ...bool) *StringStringMap

func NewStringStringMapFromArray added in v1.5.0

func NewStringStringMapFromArray(keys []string, values []string, unsafe ...bool) *StringStringMap

func (*StringStringMap) BatchRemove added in v1.5.0

func (gm *StringStringMap) BatchRemove(keys []string)

批量删除键值对

func (*StringStringMap) BatchSet added in v1.5.0

func (gm *StringStringMap) BatchSet(m map[string]string)

批量设置键值对

func (*StringStringMap) Clear added in v1.5.0

func (gm *StringStringMap) Clear()

清空哈希表

func (*StringStringMap) Clone added in v1.5.0

func (gm *StringStringMap) Clone() *StringStringMap

哈希表克隆.

func (*StringStringMap) Contains added in v1.5.0

func (gm *StringStringMap) Contains(key string) bool

是否存在某个键

func (*StringStringMap) Flip added in v1.5.0

func (gm *StringStringMap) Flip()

交换Map中的键和值.

func (*StringStringMap) Get added in v1.5.0

func (gm *StringStringMap) Get(key string) string

获取键值

func (*StringStringMap) GetOrSet added in v1.5.0

func (gm *StringStringMap) GetOrSet(key string, value string) string

当键名存在时返回其键值,否则写入指定的键值

func (*StringStringMap) GetOrSetFunc added in v1.5.0

func (gm *StringStringMap) GetOrSetFunc(key string, f func() string) string

当键名存在时返回其键值,否则写入指定的键值,键值由指定的函数生成

func (*StringStringMap) GetOrSetFuncLock added in v1.5.0

func (gm *StringStringMap) GetOrSetFuncLock(key string, f func() string) string

与GetOrSetFunc不同的是,f是在写锁机制内执行

func (*StringStringMap) IsEmpty added in v1.5.0

func (gm *StringStringMap) IsEmpty() bool

哈希表是否为空

func (*StringStringMap) Iterator added in v1.5.0

func (gm *StringStringMap) Iterator(f func(k string, v string) bool)

给定回调函数对原始内容进行遍历,回调函数返回true表示继续遍历,否则停止遍历

func (*StringStringMap) Keys added in v1.5.0

func (gm *StringStringMap) Keys() []string

返回键列表

func (*StringStringMap) LockFunc added in v1.5.0

func (gm *StringStringMap) LockFunc(f func(m map[string]string))

并发安全写锁操作,使用自定义方法执行加锁修改操作

func (*StringStringMap) Map added in v1.5.0

func (gm *StringStringMap) Map() map[string]string

返回当前哈希表的数据Map.

func (*StringStringMap) Merge added in v1.5.0

func (gm *StringStringMap) Merge(m *StringStringMap)

合并两个Map.

func (*StringStringMap) RLockFunc added in v1.5.0

func (gm *StringStringMap) RLockFunc(f func(m map[string]string))

并发安全读锁操作,使用自定义方法执行加锁读取操作

func (*StringStringMap) Remove added in v1.5.0

func (gm *StringStringMap) Remove(key string) string

返回对应的键值,并删除该键值

func (*StringStringMap) Set added in v1.5.0

func (gm *StringStringMap) Set(key string, val string)

设置键值对

func (*StringStringMap) SetIfNotExist added in v1.5.0

func (gm *StringStringMap) SetIfNotExist(key string, value string) bool

当键名不存在时写入,并返回true;否则返回false。

func (*StringStringMap) Size added in v1.5.0

func (gm *StringStringMap) Size() int

哈希表大小

func (*StringStringMap) Values added in v1.5.0

func (gm *StringStringMap) Values() []string

返回值列表(注意是随机排序)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL