internal

package
v0.0.0-...-c902e56 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapToStruct

func MapToStruct(m map[string]interface{}, ptr interface{}) error

将map转化为struct,支持弱类型,比如map中为"12313"的值,可以被转化到struct中类型为int的>字段中 支持的tag为mapstructure:"map的key",map中为此key的字段将被转化到tag所在的字段中 底层使用github.com/mitchellh/mapstructure

func StructToMap

func StructToMap(s interface{}) map[string]interface{}

将struct转化为map,支持嵌套的struct 未导出的字段不会转化到map中 支持的tag为structs:"map的key" structs:"-"表明这个字段被忽略,不会转化到map中 底层使用github.com/fatih/structs,今后可能会统一为github.com/mitchellh/mapstructure

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