bzgncmap

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K comparable, V comparable] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, V comparable](opts ...MapOption[K, V]) *Map[K, V]

func (*Map[K, V]) AddJson

func (m *Map[K, V]) AddJson(jsonString string) error

AddJson 合并json

func (*Map[K, V]) Cap

func (m *Map[K, V]) Cap() int32

Cap 获取map容量

func (*Map[K, V]) Copy

func (m *Map[K, V]) Copy() map[K]V

Copy 复制

func (*Map[K, V]) Delete

func (m *Map[K, V]) Delete(keys ...K)

Delete 删除 @param key K 键

func (*Map[K, V]) Exist

func (m *Map[K, V]) Exist(key K) bool

Exist 是否存在 @param key K 键 @return exist bool 是否存在

func (*Map[K, V]) ExistPut

func (m *Map[K, V]) ExistPut(key K, f func(val *V)) bool

func (*Map[K, V]) FilterEmpty

func (m *Map[K, V]) FilterEmpty()

FilterEmpty 部分空值过滤

func (*Map[K, V]) FilterNil

func (m *Map[K, V]) FilterNil()

FilterNil 空值过滤

func (*Map[K, V]) FilterUniqueValue

func (m *Map[K, V]) FilterUniqueValue()

FilterUniqueValue 重复值过滤

func (*Map[K, V]) Flush

func (m *Map[K, V]) Flush()

Flush 清空

func (*Map[K, V]) Get

func (m *Map[K, V]) Get(key K) (V, bool)

Get 获取 @param key K 键 @return val V 值 @return exist bool 是否存在

func (*Map[K, V]) GetKeys

func (m *Map[K, V]) GetKeys() []K

GetKeys 获取所有key

func (*Map[K, V]) GetOrDefault

func (m *Map[K, V]) GetOrDefault(key K, def V) (V, bool)

GetOrDefault 获取或得到默认值 @param key K 键 @return val V 值 @return exist bool 是否存在

func (*Map[K, V]) GetOrPut

func (m *Map[K, V]) GetOrPut(key K, val V) (V, bool)

GetOrPut 获取或新增 @param key K 键 @return val V 值 @return exist bool 是否存在

func (*Map[K, V]) GetRand

func (m *Map[K, V]) GetRand(count int) map[K]V

GetRand 随机获取 map

func (*Map[K, V]) GetValues

func (m *Map[K, V]) GetValues() []V

GetValues 获取所有value

func (*Map[K, V]) IsEmpty

func (m *Map[K, V]) IsEmpty() bool

IsEmpty 获取map是否为空

func (*Map[K, V]) IsEqual

func (m *Map[K, V]) IsEqual(newM *Map[K, V]) bool

IsEqual 判断map是否相同

func (*Map[K, V]) Json

func (m *Map[K, V]) Json() (string, error)

Json 获取json结果

func (*Map[K, V]) Len

func (m *Map[K, V]) Len() int32

Len 获取map数量

func (*Map[K, V]) Merge

func (m *Map[K, V]) Merge(newM *Map[K, V]) bool

Merge 合并

func (*Map[K, V]) Pop

func (m *Map[K, V]) Pop(count int) map[K]V

Pop 随机出栈

func (*Map[K, V]) Put

func (m *Map[K, V]) Put(key K, val V) bool

Put 新增 @param key K 键 @param val V 值

func (*Map[K, V]) PutMany

func (m *Map[K, V]) PutMany(ms map[K]V) bool

PutMany 新增多个

func (*Map[K, V]) Range

func (m *Map[K, V]) Range(fn func(K, V) bool)

Range 遍历

func (*Map[K, V]) Result

func (m *Map[K, V]) Result() map[K]V

Result 获取结果

func (*Map[K, V]) Search

func (m *Map[K, V]) Search(fn func(key K, value V) bool) map[K]V

Search 自定义查询 @param key K 键 @return val V 值 @return exist bool 是否存在

func (*Map[K, V]) Turn

func (m *Map[K, V]) Turn() map[V]K

Turn k v 翻转

func (*Map[K, V]) ValueCount

func (m *Map[K, V]) ValueCount(value V) int32

ValueCount 获取value出现次数

type MapOption

type MapOption[K comparable, V comparable] func(m *Map[K, V])

func InitCap

func InitCap[K comparable, V comparable](cap int) MapOption[K, V]

func IsUnique

func IsUnique[K comparable, V comparable](isUnique bool) MapOption[K, V]

func LazyShrink

func LazyShrink[K comparable, V comparable](b bool) MapOption[K, V]

Jump to

Keyboard shortcuts

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