dict

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[TVal any, TKey comparable](fn func(v TVal) (bool, TVal), values map[TKey]TVal) (ret []TVal)

Filter 过滤数组

func GetKeys

func GetKeys[T1 comparable, T2 any | ~struct{} | string | int |
	int8 | int16 | int32 | int64 | uint |
	uint8 | uint16 | uint32 | uint64](sources map[T1]T2) []T1

GetKeys 获取一个字典中所有的key

func GetValue

func GetValue(obj map[string]any, key string, def any) any

GetValue 获取值

func GetValues added in v1.2.0

func GetValues[K comparable, V any | ~struct{}](target map[K]V) []V

GetValues 获取一个字典中所有的value

func SetValue

func SetValue(obj map[string]any, key string, val, def any)

SetValue 设置值

func Zip

func Zip[TKey ~struct{} | string | int |
	int8 | int16 | int32 | int64 | uint |
	uint8 | uint16 | uint32 | uint64,
	TVal ~struct{} | string | int |
		int8 | int16 | int32 | int64 | uint |
		uint8 | uint16 | uint32 | uint64](keys []TKey, values []TVal) (zip map[TKey]TVal, err error)

Zip 压缩数据到map

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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