map_tool

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopyMap

func DeepCopyMap(originalMap map[string]interface{}) (newMap map[string]interface{})

DeepCopy 深度拷贝一个map

func SplitMapTo

func SplitMapTo(maps *map[string]interface{}, length int) (splitMapArray []map[string]interface{}, groups int)

将一个map的key:value分成最大数量length个的若干个map 组成的array,分成了groups个 当maps为空map时,groups = 0

func StructToMap

func StructToMap(obj interface{}, tag string) map[string]interface{}

将结构体转换为map obj为某个结构体的实例 tag为结构体里某项的tag,例如`json:"id"`的"json" 注意:如果用于存为redis的hashSet,嵌套的struct转为map可能有问题 注意:如果存到redis,time.Time也有问题

Types

This section is empty.

Jump to

Keyboard shortcuts

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