Map

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append[T any](data map[string]T, append map[string]T)

Append 将一个map合并到另一个map中

func BuildKeys added in v1.0.1

func BuildKeys[K any](mapData interface{}, keyType K) []K

func BuildMapByKey added in v1.0.1

func BuildMapByKey(mapList []map[string]interface{}, mapKey string) map[interface{}]interface{}

func BuildMapByStringKey added in v1.0.1

func BuildMapByStringKey(mapList []map[string]interface{}, mapKey string) map[string]interface{}

func BuildSliceByStringKey added in v1.0.2

func BuildSliceByStringKey[V any](mapList []map[string]interface{}, keyName string, valueType V) []V

func BuildValues added in v1.0.1

func BuildValues[V any](mapData interface{}, valueType V) []V

func Clear added in v1.0.1

func Clear[T any](list map[string]T)

func Clone

func Clone[T any](data map[string]T) map[string]T

Clone 浅拷贝一个副本

func ComputeIfAbsent

func ComputeIfAbsent[T any, E any](data map[string]E, key string, defaultValue T) T

ComputeIfAbsent 通过反射板,绕过GO编译器的类型检查,注意:T和E的类型,实际上必须相同

func DelValue

func DelValue(data map[string]interface{}, keys ...interface{})

func GetBool added in v1.0.1

func GetBool(data map[string]interface{}, key string, defaultValue bool) bool

func GetFloat64 added in v1.0.1

func GetFloat64(data map[string]interface{}, key string, defaultValue float64) float64

func GetInt added in v1.0.1

func GetInt(data map[string]interface{}, key string, defaultValue int) int

func GetInt64 added in v1.0.1

func GetInt64(data map[string]interface{}, key string, defaultValue int64) int64

func GetKeys

func GetKeys[T any](data map[string]T) []string

func GetMap added in v1.0.1

func GetMap(data map[string]interface{}, key string, defaultValue map[string]interface{}) map[string]interface{}

func GetOrDefault

func GetOrDefault(data map[string]interface{}, key string, defaultValue interface{}) interface{}

GetOrDefault 获得元素,如果不存在,以默认值返回

func GetSlice added in v1.0.1

func GetSlice(data map[string]interface{}, key string, defaultValue []interface{}) []interface{}

func GetString added in v1.0.1

func GetString(data map[string]interface{}, key string, defaultValue string) string

func GetValue

func GetValue(data map[string]interface{}, keys ...interface{}) (interface{}, error)

func Has added in v1.0.1

func Has(data map[string]interface{}, key string) bool

func HasNull added in v1.0.1

func HasNull(data map[string]interface{}, keys ...interface{}) bool

func MergeValue added in v1.0.2

func MergeValue(data map[string]interface{}, dataKey string, src map[string]interface{}, srcKey string)

func SetDefaultValue added in v1.0.1

func SetDefaultValue(data map[string]interface{}, key string, defaultValue interface{})

SetDefaultValue 确认是否存在某个元素,如果不存在,以默认值填入

func SetValue

func SetValue(data map[string]interface{}, keys ...interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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