convert

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelToUnderline

func CamelToUnderline(name string) string

CamelToUnderline 驼峰转下划线

func MapToStruct

func MapToStruct(obj interface{}, ret interface{}) error

func StructToJSON

func StructToJSON(params interface{}) (json.RawMessage, error)

func StructToMap

func StructToMap(obj interface{}) (ret map[string]interface{}, err error)

func StructToQuery

func StructToQuery(obj interface{}) (ret httpURL.Values, err error)

StructToQuery 支持 结构体和map[string]interface{}

func StructToStruct

func StructToStruct(src interface{}, target interface{}) (err error)

StructToStruct 传入两个结构体, src可以传指针也可以传值, target必须传指针. 使用要求必须同字段,且要同类型.

func XMLToMap

func XMLToMap(buf []byte) (stringMap map[string]string, err error)

这个方法只能转换单层XML

Types

type XMLMap

type XMLMap map[string]string

func (XMLMap) MarshalXML

func (m XMLMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*XMLMap) UnmarshalXML

func (m *XMLMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

这种写法只能转换单层

Jump to

Keyboard shortcuts

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