Documentation ¶
Overview ¶
Package dashconv
类型转换工具
Type conversion tool
Index ¶
- func ByteToStr(b []byte) string
- func ByteToStrByUnsafe(b []byte) string
- func GbkToUtf8(s []byte) ([]byte, error)
- func ObjToMap(data any) (maps any, err error)
- func StrToByte(s string) []byte
- func StrToByteByReflect(s string) []bytedeprecated
- func StrToByteByUnsafe(s string) []byte
- func TransEncoding(src string, srcCode string, dstCode string) string
- func Utf8ToGbk(s []byte) ([]byte, error)
- func WeakMapToStructWithTag(inMap, outStruct any, tagName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ObjToMap ¶
ObjToMap @Editor robotyang at 2023
ObjToMap 转换 数据为Map结构 ¶
@Param data:支持 struct、map、slice 以及它们的指针类型
@Return maps:可为 map[string]any、[]any
func StrToByteByReflect
deprecated
Deprecated: StrToByteByReflect @Editor robotyang at 2023(运行时可能不可靠,仅供学习)
StrToByteByReflect @Editor robotyang at 2023
StrToByteByReflect 将字符串转换为字节片而不分配内存。注意,如果字符串和/或切片头在未来的go版本中改变,它可能会中断。 ¶
# StrToByteByReflect converts string to a byte slice without memory allocation. Note it may break if string and/or slice header will change in the future go versions.
func TransEncoding ¶
TransEncoding @Editor robotyang at 2023
TransEncoding 转换 字符串 编码类型 ¶
@Param src:原字符串
@Param srcCode:原字符串 编码类型,如 "gbk"、"utf-8"
@Param dstCode:目标字符串 编码类型,如 "gbk"、"utf-8"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.