gf: github.com/johng-cn/gf/g/container/gmap Index | Files

package gmap

import "github.com/johng-cn/gf/g/container/gmap"

Package gmap provides concurrent-safe/unsafe maps.

Index

Package Files

gmap.go gmap_func.go gmap_int_bool_map.go gmap_int_int_map.go gmap_int_interface_map.go gmap_int_string_map.go gmap_string_bool_map.go gmap_string_int_map.go gmap_string_interface_map.go gmap_string_string_map.go

type IntBoolMap Uses

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

func NewIntBoolMap Uses

func NewIntBoolMap(unsafe ...bool) *IntBoolMap

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

func NewIntBoolMapFrom Uses

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

NewIntBoolMapFrom returns an IntBoolMap object from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewIntBoolMapFromArray Uses

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

NewIntBoolMapFromArray returns an IntBoolMap from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func (*IntBoolMap) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*IntBoolMap) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*IntBoolMap) Clear Uses

func (gm *IntBoolMap) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*IntBoolMap) Clone Uses

func (gm *IntBoolMap) Clone() *IntBoolMap

Clone returns a new hash map with copy of current map data.

func (*IntBoolMap) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*IntBoolMap) Get Uses

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

Get returns the value by given <key>.

func (*IntBoolMap) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*IntBoolMap) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*IntBoolMap) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*IntBoolMap) IsEmpty Uses

func (gm *IntBoolMap) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*IntBoolMap) Iterator Uses

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

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

func (*IntBoolMap) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*IntBoolMap) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*IntBoolMap) Map Uses

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

Map returns a copy of the data of the hash map.

func (*IntBoolMap) Merge Uses

func (gm *IntBoolMap) Merge(other *IntBoolMap)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*IntBoolMap) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*IntBoolMap) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*IntBoolMap) Set Uses

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

Set sets key-value to the hash map.

func (*IntBoolMap) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*IntBoolMap) SetIfNotExistFunc Uses

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

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*IntBoolMap) SetIfNotExistFuncLock Uses

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

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*IntBoolMap) Size Uses

func (gm *IntBoolMap) Size() int

Size returns the size of the map.

type IntIntMap Uses

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

func NewIntIntMap Uses

func NewIntIntMap(unsafe ...bool) *IntIntMap

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

func NewIntIntMapFrom Uses

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

NewIntIntMapFrom returns an IntIntMap object from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewIntIntMapFromArray Uses

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

NewIntIntMapFromArray returns an IntIntMap object from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func (*IntIntMap) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*IntIntMap) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*IntIntMap) Clear Uses

func (gm *IntIntMap) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*IntIntMap) Clone Uses

func (gm *IntIntMap) Clone() *IntIntMap

Clone returns a new hash map with copy of current map data.

func (*IntIntMap) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*IntIntMap) Flip Uses

func (gm *IntIntMap) Flip()

Flip exchanges key-value of the map, it will change key-value to value-key.

func (*IntIntMap) Get Uses

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

Get returns the value by given <key>.

func (*IntIntMap) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*IntIntMap) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*IntIntMap) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*IntIntMap) IsEmpty Uses

func (gm *IntIntMap) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*IntIntMap) Iterator Uses

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

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

func (*IntIntMap) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*IntIntMap) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*IntIntMap) Map Uses

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

Map returns a copy of the data of the hash map.

func (*IntIntMap) Merge Uses

func (gm *IntIntMap) Merge(other *IntIntMap)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*IntIntMap) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*IntIntMap) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*IntIntMap) Set Uses

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

Set sets key-value to the hash map.

func (*IntIntMap) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*IntIntMap) SetIfNotExistFunc Uses

func (gm *IntIntMap) SetIfNotExistFunc(key int, f func() int) bool

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*IntIntMap) SetIfNotExistFuncLock Uses

func (gm *IntIntMap) SetIfNotExistFuncLock(key int, f func() int) bool

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*IntIntMap) Size Uses

func (gm *IntIntMap) Size() int

Size returns the size of the map.

func (*IntIntMap) Values Uses

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

Values returns all values of the map as a slice.

type IntInterfaceMap Uses

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

func NewIntInterfaceMap Uses

func NewIntInterfaceMap(unsafe ...bool) *IntInterfaceMap

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

func NewIntInterfaceMapFrom Uses

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

NewIntInterfaceMapFrom returns an IntInterfaceMap object from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewIntInterfaceMapFromArray Uses

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

NewFromArray returns a hash map from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func (*IntInterfaceMap) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*IntInterfaceMap) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*IntInterfaceMap) Clear Uses

func (gm *IntInterfaceMap) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*IntInterfaceMap) Clone Uses

func (gm *IntInterfaceMap) Clone() *IntInterfaceMap

Clone returns a new hash map with copy of current map data.

func (*IntInterfaceMap) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*IntInterfaceMap) Flip Uses

func (gm *IntInterfaceMap) Flip()

Flip exchanges key-value of the map, it will change key-value to value-key.

func (*IntInterfaceMap) Get Uses

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

Get returns the value by given <key>.

func (*IntInterfaceMap) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*IntInterfaceMap) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*IntInterfaceMap) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*IntInterfaceMap) IsEmpty Uses

func (gm *IntInterfaceMap) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*IntInterfaceMap) Iterator Uses

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

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

func (*IntInterfaceMap) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*IntInterfaceMap) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*IntInterfaceMap) Map Uses

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

Map returns a copy of the data of the hash map.

func (*IntInterfaceMap) Merge Uses

func (gm *IntInterfaceMap) Merge(other *IntInterfaceMap)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*IntInterfaceMap) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*IntInterfaceMap) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*IntInterfaceMap) Set Uses

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

Set sets key-value to the hash map.

func (*IntInterfaceMap) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*IntInterfaceMap) SetIfNotExistFunc Uses

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

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*IntInterfaceMap) SetIfNotExistFuncLock Uses

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

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*IntInterfaceMap) Size Uses

func (gm *IntInterfaceMap) Size() int

Size returns the size of the map.

func (*IntInterfaceMap) Values Uses

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

Values returns all values of the map as a slice.

type IntStringMap Uses

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

func NewIntStringMap Uses

func NewIntStringMap(unsafe ...bool) *IntStringMap

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

func NewIntStringMapFrom Uses

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

NewIntStringMapFrom returns an IntStringMap object from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewIntStringMapFromArray Uses

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

NewIntStringMapFromArray returns an IntStringMap object from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func (*IntStringMap) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*IntStringMap) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*IntStringMap) Clear Uses

func (gm *IntStringMap) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*IntStringMap) Clone Uses

func (gm *IntStringMap) Clone() *IntStringMap

Clone returns a new hash map with copy of current map data.

func (*IntStringMap) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*IntStringMap) Flip Uses

func (gm *IntStringMap) Flip()

Flip exchanges key-value of the map, it will change key-value to value-key.

func (*IntStringMap) Get Uses

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

Get returns the value by given <key>.

func (*IntStringMap) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*IntStringMap) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*IntStringMap) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*IntStringMap) IsEmpty Uses

func (gm *IntStringMap) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*IntStringMap) Iterator Uses

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

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

func (*IntStringMap) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*IntStringMap) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*IntStringMap) Map Uses

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

Map returns a copy of the data of the hash map.

func (*IntStringMap) Merge Uses

func (gm *IntStringMap) Merge(other *IntStringMap)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*IntStringMap) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*IntStringMap) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*IntStringMap) Set Uses

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

Set sets key-value to the hash map.

func (*IntStringMap) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*IntStringMap) SetIfNotExistFunc Uses

func (gm *IntStringMap) SetIfNotExistFunc(key int, f func() string) bool

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*IntStringMap) SetIfNotExistFuncLock Uses

func (gm *IntStringMap) SetIfNotExistFuncLock(key int, f func() string) bool

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*IntStringMap) Size Uses

func (gm *IntStringMap) Size() int

Size returns the size of the map.

func (*IntStringMap) Values Uses

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

Values returns all values of the map as a slice.

type Map Uses

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

func New Uses

func New(unsafe ...bool) *Map

New returns 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.

func NewFrom Uses

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

NewFrom returns a hash map from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewFromArray Uses

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

NewFromArray returns a hash map from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func NewMap Uses

func NewMap(unsafe ...bool) *Map

Alias of New. See New.

func (*Map) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*Map) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*Map) Clear Uses

func (gm *Map) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*Map) Clone Uses

func (gm *Map) Clone(unsafe ...bool) *Map

Clone returns a new hash map with copy of current map data.

func (*Map) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*Map) Flip Uses

func (gm *Map) Flip()

Flip exchanges key-value of the map, it will change key-value to value-key.

func (*Map) Get Uses

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

Get returns the value by given <key>.

func (*Map) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*Map) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*Map) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*Map) IsEmpty Uses

func (gm *Map) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*Map) Iterator Uses

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

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

func (*Map) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*Map) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*Map) Map Uses

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

Map returns a copy of the data of the hash map.

func (*Map) Merge Uses

func (gm *Map) Merge(other *Map)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*Map) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*Map) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*Map) Set Uses

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

Set sets key-value to the hash map.

func (*Map) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*Map) SetIfNotExistFunc Uses

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

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*Map) SetIfNotExistFuncLock Uses

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

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*Map) Size Uses

func (gm *Map) Size() int

Size returns the size of the map.

func (*Map) Values Uses

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

Values returns all values of the map as a slice.

type StringBoolMap Uses

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

func NewStringBoolMap Uses

func NewStringBoolMap(unsafe ...bool) *StringBoolMap

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

func NewStringBoolMapFrom Uses

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

NewStringBoolMapFrom returns an StringBoolMap object from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewStringBoolMapFromArray Uses

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

NewFromArray returns a hash map from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func (*StringBoolMap) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*StringBoolMap) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*StringBoolMap) Clear Uses

func (gm *StringBoolMap) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*StringBoolMap) Clone Uses

func (gm *StringBoolMap) Clone() *StringBoolMap

Clone returns a new hash map with copy of current map data.

func (*StringBoolMap) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*StringBoolMap) Get Uses

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

Get returns the value by given <key>.

func (*StringBoolMap) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*StringBoolMap) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*StringBoolMap) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*StringBoolMap) IsEmpty Uses

func (gm *StringBoolMap) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*StringBoolMap) Iterator Uses

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

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

func (*StringBoolMap) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*StringBoolMap) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*StringBoolMap) Map Uses

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

Map returns a copy of the data of the hash map.

func (*StringBoolMap) Merge Uses

func (gm *StringBoolMap) Merge(other *StringBoolMap)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*StringBoolMap) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*StringBoolMap) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*StringBoolMap) Set Uses

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

Set sets key-value to the hash map.

func (*StringBoolMap) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*StringBoolMap) SetIfNotExistFunc Uses

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

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*StringBoolMap) SetIfNotExistFuncLock Uses

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

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*StringBoolMap) Size Uses

func (gm *StringBoolMap) Size() int

Size returns the size of the map.

type StringIntMap Uses

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

func NewStringIntMap Uses

func NewStringIntMap(unsafe ...bool) *StringIntMap

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

func NewStringIntMapFrom Uses

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

NewStringIntMapFrom returns an StringIntMap object from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewStringIntMapFromArray Uses

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

NewStringIntMapFromArray returns an StringIntMap object from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func (*StringIntMap) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*StringIntMap) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*StringIntMap) Clear Uses

func (gm *StringIntMap) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*StringIntMap) Clone Uses

func (gm *StringIntMap) Clone() *StringIntMap

Clone returns a new hash map with copy of current map data.

func (*StringIntMap) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*StringIntMap) Flip Uses

func (gm *StringIntMap) Flip()

Flip exchanges key-value of the map, it will change key-value to value-key.

func (*StringIntMap) Get Uses

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

Get returns the value by given <key>.

func (*StringIntMap) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*StringIntMap) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*StringIntMap) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*StringIntMap) IsEmpty Uses

func (gm *StringIntMap) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*StringIntMap) Iterator Uses

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

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

func (*StringIntMap) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*StringIntMap) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*StringIntMap) Map Uses

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

Map returns a copy of the data of the hash map.

func (*StringIntMap) Merge Uses

func (gm *StringIntMap) Merge(other *StringIntMap)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*StringIntMap) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*StringIntMap) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*StringIntMap) Set Uses

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

Set sets key-value to the hash map.

func (*StringIntMap) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*StringIntMap) SetIfNotExistFunc Uses

func (gm *StringIntMap) SetIfNotExistFunc(key string, f func() int) bool

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*StringIntMap) SetIfNotExistFuncLock Uses

func (gm *StringIntMap) SetIfNotExistFuncLock(key string, f func() int) bool

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*StringIntMap) Size Uses

func (gm *StringIntMap) Size() int

Size returns the size of the map.

func (*StringIntMap) Values Uses

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

Values returns all values of the map as a slice.

type StringInterfaceMap Uses

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

func NewStringInterfaceMap Uses

func NewStringInterfaceMap(unsafe ...bool) *StringInterfaceMap

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

func NewStringInterfaceMapFrom Uses

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

NewStringInterfaceMapFrom returns an StringInterfaceMap object from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewStringInterfaceMapFromArray Uses

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

NewStringInterfaceMapFromArray returns an StringInterfaceMap object from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func (*StringInterfaceMap) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*StringInterfaceMap) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*StringInterfaceMap) Clear Uses

func (gm *StringInterfaceMap) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*StringInterfaceMap) Clone Uses

func (gm *StringInterfaceMap) Clone() *StringInterfaceMap

Clone returns a new hash map with copy of current map data.

func (*StringInterfaceMap) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*StringInterfaceMap) Flip Uses

func (gm *StringInterfaceMap) Flip()

Flip exchanges key-value of the map, it will change key-value to value-key.

func (*StringInterfaceMap) Get Uses

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

Get returns the value by given <key>.

func (*StringInterfaceMap) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*StringInterfaceMap) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*StringInterfaceMap) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*StringInterfaceMap) IsEmpty Uses

func (gm *StringInterfaceMap) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*StringInterfaceMap) Iterator Uses

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

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

func (*StringInterfaceMap) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*StringInterfaceMap) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*StringInterfaceMap) Map Uses

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

Map returns a copy of the data of the hash map.

func (*StringInterfaceMap) Merge Uses

func (gm *StringInterfaceMap) Merge(other *StringInterfaceMap)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*StringInterfaceMap) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*StringInterfaceMap) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*StringInterfaceMap) Set Uses

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

Set sets key-value to the hash map.

func (*StringInterfaceMap) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*StringInterfaceMap) SetIfNotExistFunc Uses

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

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*StringInterfaceMap) SetIfNotExistFuncLock Uses

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

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*StringInterfaceMap) Size Uses

func (gm *StringInterfaceMap) Size() int

Size returns the size of the map.

func (*StringInterfaceMap) Values Uses

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

Values returns all values of the map as a slice.

type StringStringMap Uses

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

func NewStringStringMap Uses

func NewStringStringMap(unsafe ...bool) *StringStringMap

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

func NewStringStringMapFrom Uses

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

NewStringStringMapFrom returns an StringStringMap object from given map <m>. Notice that, the param map is a type of pointer, there might be some concurrent-safe issues when changing the map outside.

func NewStringStringMapFromArray Uses

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

NewStringStringMapFromArray returns an StringStringMap object from given array. The param <keys> given as the keys of the map, and <values> as its corresponding values.

If length of <keys> is greater than that of <values>, the corresponding overflow map values will be the default value of its type.

func (*StringStringMap) BatchRemove Uses

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

BatchRemove batch deletes values of the map by keys.

func (*StringStringMap) BatchSet Uses

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

BatchSet batch sets key-values to the hash map.

func (*StringStringMap) Clear Uses

func (gm *StringStringMap) Clear()

Clear deletes all data of the map, it will remake a new underlying map data map.

func (*StringStringMap) Clone Uses

func (gm *StringStringMap) Clone() *StringStringMap

Clone returns a new hash map with copy of current map data.

func (*StringStringMap) Contains Uses

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

Contains checks whether a key exists. It returns true if the <key> exists, or else false.

func (*StringStringMap) Flip Uses

func (gm *StringStringMap) Flip()

Flip exchanges key-value of the map, it will change key-value to value-key.

func (*StringStringMap) Get Uses

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

Get returns the value by given <key>.

func (*StringStringMap) GetOrSet Uses

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

GetOrSet returns the value by key, or set value with given <value> if not exist and returns this value.

func (*StringStringMap) GetOrSetFunc Uses

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

GetOrSetFunc returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

func (*StringStringMap) GetOrSetFuncLock Uses

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

GetOrSetFuncLock returns the value by key, or sets value with return value of callback function <f> if not exist and returns this value.

GetOrSetFuncLock differs with GetOrSetFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*StringStringMap) IsEmpty Uses

func (gm *StringStringMap) IsEmpty() bool

IsEmpty checks whether the map is empty. It returns true if map is empty, or else false.

func (*StringStringMap) Iterator Uses

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

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

func (*StringStringMap) Keys Uses

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

Keys returns all keys of the map as a slice.

func (*StringStringMap) LockFunc Uses

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

LockFunc locks writing with given callback function <f> and mutex.Lock.

func (*StringStringMap) Map Uses

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

Map returns a copy of the data of the hash map.

func (*StringStringMap) Merge Uses

func (gm *StringStringMap) Merge(other *StringStringMap)

Merge merges two hash maps. The <other> map will be merged into the map <gm>.

func (*StringStringMap) RLockFunc Uses

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

RLockFunc locks reading with given callback function <f> and mutex.RLock.

func (*StringStringMap) Remove Uses

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

Remove deletes value from map by given <key>, and return this deleted value.

func (*StringStringMap) Set Uses

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

Set sets key-value to the hash map.

func (*StringStringMap) SetIfNotExist Uses

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

SetIfNotExist sets <value> to the map if the <key> does not exist, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*StringStringMap) SetIfNotExistFunc Uses

func (gm *StringStringMap) SetIfNotExistFunc(key string, f func() string) bool

SetIfNotExistFunc sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

func (*StringStringMap) SetIfNotExistFuncLock Uses

func (gm *StringStringMap) SetIfNotExistFuncLock(key string, f func() string) bool

SetIfNotExistFuncLock sets value with return value of callback function <f>, then return true. It returns false if <key> exists, and <value> would be ignored.

SetIfNotExistFuncLock differs with SetIfNotExistFunc function is that it executes function <f> with mutex.Lock of the hash map.

func (*StringStringMap) Size Uses

func (gm *StringStringMap) Size() int

Size returns the size of the map.

func (*StringStringMap) Values Uses

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

Values returns all values of the map as a slice.

Package gmap imports 2 packages (graph). Updated 2019-04-12. Refresh now. Tools for package owners.