gmap

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 1 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

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

func NewIntBoolMap

func NewIntBoolMap(unsafe ...bool) *IntBoolMap

func (*IntBoolMap) BatchRemove

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

批量删除键值对

func (*IntBoolMap) BatchSet

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

批量设置键值对

func (*IntBoolMap) Clear

func (this *IntBoolMap) Clear()

清空哈希表

func (*IntBoolMap) Clone

func (this *IntBoolMap) Clone() map[int]bool

哈希表克隆

func (*IntBoolMap) Contains

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

是否存在某个键

func (*IntBoolMap) Get

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

获取键值

func (*IntBoolMap) GetOrSet

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

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

func (*IntBoolMap) GetOrSetFunc

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

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

func (*IntBoolMap) GetOrSetFuncLock

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

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

func (*IntBoolMap) IsEmpty

func (this *IntBoolMap) IsEmpty() bool

哈希表是否为空

func (*IntBoolMap) Iterator

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

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

func (*IntBoolMap) Keys

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

返回键列表

func (*IntBoolMap) LockFunc

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

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

func (*IntBoolMap) RLockFunc

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

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

func (*IntBoolMap) Remove

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

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

func (*IntBoolMap) Set

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

设置键值对

func (*IntBoolMap) SetIfNotExist

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

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

func (*IntBoolMap) Size

func (this *IntBoolMap) Size() int

哈希表大小

type IntIntMap

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

func NewIntIntMap

func NewIntIntMap(unsafe ...bool) *IntIntMap

func (*IntIntMap) BatchRemove

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

批量删除键值对

func (*IntIntMap) BatchSet

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

批量设置键值对

func (*IntIntMap) Clear

func (this *IntIntMap) Clear()

清空哈希表

func (*IntIntMap) Clone

func (this *IntIntMap) Clone() map[int]int

哈希表克隆

func (*IntIntMap) Contains

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

是否存在某个键

func (*IntIntMap) Get

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

获取键值

func (*IntIntMap) GetOrSet

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

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

func (*IntIntMap) GetOrSetFunc

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

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

func (*IntIntMap) GetOrSetFuncLock

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

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

func (*IntIntMap) IsEmpty

func (this *IntIntMap) IsEmpty() bool

哈希表是否为空

func (*IntIntMap) Iterator

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

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

func (*IntIntMap) Keys

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

返回键列表

func (*IntIntMap) LockFunc

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

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

func (*IntIntMap) RLockFunc

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

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

func (*IntIntMap) Remove

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

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

func (*IntIntMap) Set

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

设置键值对

func (*IntIntMap) SetIfNotExist

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

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

func (*IntIntMap) Size

func (this *IntIntMap) Size() int

哈希表大小

func (*IntIntMap) Values

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

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

type IntInterfaceMap

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

func NewIntInterfaceMap

func NewIntInterfaceMap(unsafe ...bool) *IntInterfaceMap

func (*IntInterfaceMap) BatchRemove

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

批量删除键值对

func (*IntInterfaceMap) BatchSet

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

批量设置键值对

func (*IntInterfaceMap) Clear

func (this *IntInterfaceMap) Clear()

清空哈希表

func (*IntInterfaceMap) Clone

func (this *IntInterfaceMap) Clone() map[int]interface{}

哈希表克隆

func (*IntInterfaceMap) Contains

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

是否存在某个键

func (*IntInterfaceMap) Get

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

获取键值

func (*IntInterfaceMap) GetOrSet

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

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

func (*IntInterfaceMap) GetOrSetFunc

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

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

func (*IntInterfaceMap) GetOrSetFuncLock

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

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

func (*IntInterfaceMap) IsEmpty

func (this *IntInterfaceMap) IsEmpty() bool

哈希表是否为空

func (*IntInterfaceMap) Iterator

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

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

func (*IntInterfaceMap) Keys

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

返回键列表

func (*IntInterfaceMap) LockFunc

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

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

func (*IntInterfaceMap) RLockFunc

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

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

func (*IntInterfaceMap) Remove

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

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

func (*IntInterfaceMap) Set

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

设置键值对

func (*IntInterfaceMap) SetIfNotExist

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

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

func (*IntInterfaceMap) Size

func (this *IntInterfaceMap) Size() int

哈希表大小

func (*IntInterfaceMap) Values

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

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

type IntStringMap

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

func NewIntStringMap

func NewIntStringMap(unsafe ...bool) *IntStringMap

func (*IntStringMap) BatchRemove

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

批量删除键值对

func (*IntStringMap) BatchSet

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

批量设置键值对

func (*IntStringMap) Clear

func (this *IntStringMap) Clear()

清空哈希表

func (*IntStringMap) Clone

func (this *IntStringMap) Clone() map[int]string

哈希表克隆

func (*IntStringMap) Contains

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

是否存在某个键

func (*IntStringMap) Get

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

获取键值

func (*IntStringMap) GetOrSet

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

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

func (*IntStringMap) GetOrSetFunc

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

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

func (*IntStringMap) GetOrSetFuncLock

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

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

func (*IntStringMap) IsEmpty

func (this *IntStringMap) IsEmpty() bool

哈希表是否为空

func (*IntStringMap) Iterator

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

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

func (*IntStringMap) Keys

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

返回键列表

func (*IntStringMap) LockFunc

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

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

func (*IntStringMap) RLockFunc

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

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

func (*IntStringMap) Remove

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

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

func (*IntStringMap) Set

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

设置键值对

func (*IntStringMap) SetIfNotExist

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

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

func (*IntStringMap) Size

func (this *IntStringMap) Size() int

哈希表大小

func (*IntStringMap) Values

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

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

type InterfaceInterfaceMap

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

func NewInterfaceInterfaceMap

func NewInterfaceInterfaceMap(unsafe ...bool) *InterfaceInterfaceMap

func (*InterfaceInterfaceMap) BatchRemove

func (this *InterfaceInterfaceMap) BatchRemove(keys []interface{})

批量删除键值对

func (*InterfaceInterfaceMap) BatchSet

func (this *InterfaceInterfaceMap) BatchSet(m map[interface{}]interface{})

批量设置键值对

func (*InterfaceInterfaceMap) Clear

func (this *InterfaceInterfaceMap) Clear()

清空哈希表

func (*InterfaceInterfaceMap) Clone

func (this *InterfaceInterfaceMap) Clone() map[interface{}]interface{}

哈希表克隆

func (*InterfaceInterfaceMap) Contains

func (this *InterfaceInterfaceMap) Contains(key interface{}) bool

是否存在某个键

func (*InterfaceInterfaceMap) Get

func (this *InterfaceInterfaceMap) Get(key interface{}) interface{}

获取键值

func (*InterfaceInterfaceMap) GetOrSet

func (this *InterfaceInterfaceMap) GetOrSet(key interface{}, value interface{}) interface{}

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

func (*InterfaceInterfaceMap) GetOrSetFunc

func (this *InterfaceInterfaceMap) GetOrSetFunc(key interface{}, f func() interface{}) interface{}

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

func (*InterfaceInterfaceMap) GetOrSetFuncLock

func (this *InterfaceInterfaceMap) GetOrSetFuncLock(key interface{}, f func() interface{}) interface{}

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

func (*InterfaceInterfaceMap) IsEmpty

func (this *InterfaceInterfaceMap) IsEmpty() bool

哈希表是否为空

func (*InterfaceInterfaceMap) Iterator

func (this *InterfaceInterfaceMap) Iterator(f func(k interface{}, v interface{}) bool)

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

func (*InterfaceInterfaceMap) Keys

func (this *InterfaceInterfaceMap) Keys() []interface{}

返回键列表

func (*InterfaceInterfaceMap) LockFunc

func (this *InterfaceInterfaceMap) LockFunc(f func(m map[interface{}]interface{}))

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

func (*InterfaceInterfaceMap) RLockFunc

func (this *InterfaceInterfaceMap) RLockFunc(f func(m map[interface{}]interface{}))

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

func (*InterfaceInterfaceMap) Remove

func (this *InterfaceInterfaceMap) Remove(key interface{}) interface{}

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

func (*InterfaceInterfaceMap) Set

func (this *InterfaceInterfaceMap) Set(key interface{}, val interface{})

设置键值对

func (*InterfaceInterfaceMap) SetIfNotExist

func (this *InterfaceInterfaceMap) SetIfNotExist(key interface{}, value interface{}) bool

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

func (*InterfaceInterfaceMap) Size

func (this *InterfaceInterfaceMap) Size() int

哈希表大小

func (*InterfaceInterfaceMap) Values

func (this *InterfaceInterfaceMap) Values() []interface{}

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

type Map

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

func New

func New(safe ...bool) *Map

type StringBoolMap

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

func NewStringBoolMap

func NewStringBoolMap(unsafe ...bool) *StringBoolMap

func (*StringBoolMap) BatchRemove

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

批量删除键值对

func (*StringBoolMap) BatchSet

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

批量设置键值对

func (*StringBoolMap) Clear

func (this *StringBoolMap) Clear()

清空哈希表

func (*StringBoolMap) Clone

func (this *StringBoolMap) Clone() map[string]bool

哈希表克隆

func (*StringBoolMap) Contains

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

是否存在某个键

func (*StringBoolMap) Get

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

获取键值

func (*StringBoolMap) GetOrSet

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

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

func (*StringBoolMap) GetOrSetFunc

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

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

func (*StringBoolMap) GetOrSetFuncLock

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

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

func (*StringBoolMap) IsEmpty

func (this *StringBoolMap) IsEmpty() bool

哈希表是否为空

func (*StringBoolMap) Iterator

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

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

func (*StringBoolMap) Keys

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

返回键列表

func (*StringBoolMap) LockFunc

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

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

func (*StringBoolMap) RLockFunc

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

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

func (*StringBoolMap) Remove

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

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

func (*StringBoolMap) Set

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

设置键值对

func (*StringBoolMap) SetIfNotExist

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

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

func (*StringBoolMap) Size

func (this *StringBoolMap) Size() int

哈希表大小

type StringIntMap

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

func NewStringIntMap

func NewStringIntMap(unsafe ...bool) *StringIntMap

func (*StringIntMap) BatchRemove

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

批量删除键值对

func (*StringIntMap) BatchSet

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

批量设置键值对

func (*StringIntMap) Clear

func (this *StringIntMap) Clear()

清空哈希表

func (*StringIntMap) Clone

func (this *StringIntMap) Clone() map[string]int

哈希表克隆

func (*StringIntMap) Contains

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

是否存在某个键

func (*StringIntMap) Get

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

获取键值

func (*StringIntMap) GetOrSet

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

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

func (*StringIntMap) GetOrSetFunc

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

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

func (*StringIntMap) GetOrSetFuncLock

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

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

func (*StringIntMap) IsEmpty

func (this *StringIntMap) IsEmpty() bool

哈希表是否为空

func (*StringIntMap) Iterator

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

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

func (*StringIntMap) Keys

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

返回键列表

func (*StringIntMap) LockFunc

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

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

func (*StringIntMap) RLockFunc

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

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

func (*StringIntMap) Remove

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

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

func (*StringIntMap) Set

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

设置键值对

func (*StringIntMap) SetIfNotExist

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

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

func (*StringIntMap) Size

func (this *StringIntMap) Size() int

哈希表大小

func (*StringIntMap) Values

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

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

type StringInterfaceMap

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

func NewStringInterfaceMap

func NewStringInterfaceMap(unsafe ...bool) *StringInterfaceMap

func (*StringInterfaceMap) BatchRemove

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

批量删除键值对

func (*StringInterfaceMap) BatchSet

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

批量设置键值对

func (*StringInterfaceMap) Clear

func (this *StringInterfaceMap) Clear()

清空哈希表

func (*StringInterfaceMap) Clone

func (this *StringInterfaceMap) Clone() map[string]interface{}

哈希表克隆

func (*StringInterfaceMap) Contains

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

是否存在某个键

func (*StringInterfaceMap) Get

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

获取键值

func (*StringInterfaceMap) GetOrSet

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

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

func (*StringInterfaceMap) GetOrSetFunc

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

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

func (*StringInterfaceMap) GetOrSetFuncLock

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

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

func (*StringInterfaceMap) IsEmpty

func (this *StringInterfaceMap) IsEmpty() bool

哈希表是否为空

func (*StringInterfaceMap) Iterator

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

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

func (*StringInterfaceMap) Keys

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

返回键列表

func (*StringInterfaceMap) LockFunc

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

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

func (*StringInterfaceMap) RLockFunc

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

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

func (*StringInterfaceMap) Remove

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

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

func (*StringInterfaceMap) Set

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

设置键值对

func (*StringInterfaceMap) SetIfNotExist

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

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

func (*StringInterfaceMap) Size

func (this *StringInterfaceMap) Size() int

哈希表大小

func (*StringInterfaceMap) Values

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

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

type StringStringMap

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

func NewStringStringMap

func NewStringStringMap(unsafe ...bool) *StringStringMap

func (*StringStringMap) BatchRemove

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

批量删除键值对

func (*StringStringMap) BatchSet

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

批量设置键值对

func (*StringStringMap) Clear

func (this *StringStringMap) Clear()

清空哈希表

func (*StringStringMap) Clone

func (this *StringStringMap) Clone() map[string]string

哈希表克隆

func (*StringStringMap) Contains

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

是否存在某个键

func (*StringStringMap) Get

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

获取键值

func (*StringStringMap) GetOrSet

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

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

func (*StringStringMap) GetOrSetFunc

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

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

func (*StringStringMap) GetOrSetFuncLock

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

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

func (*StringStringMap) IsEmpty

func (this *StringStringMap) IsEmpty() bool

哈希表是否为空

func (*StringStringMap) Iterator

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

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

func (*StringStringMap) Keys

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

返回键列表

func (*StringStringMap) LockFunc

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

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

func (*StringStringMap) RLockFunc

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

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

func (*StringStringMap) Remove

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

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

func (*StringStringMap) Set

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

设置键值对

func (*StringStringMap) SetIfNotExist

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

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

func (*StringStringMap) Size

func (this *StringStringMap) Size() int

哈希表大小

func (*StringStringMap) Values

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

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

Jump to

Keyboard shortcuts

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