调整struct

This commit is contained in:
白茶清欢 2022-05-14 15:22:53 +08:00
parent 8d84b733b8
commit 3b612857fe
2 changed files with 14 additions and 3 deletions

View File

@ -20,6 +20,8 @@ var (
JSON *ownJSON JSON *ownJSON
// String ... // String ...
String *stringOperate String *stringOperate
// Struct ...
Struct *ownStruct
) )
func init() { func init() {
@ -29,4 +31,5 @@ func init() {
IP = &ip{} IP = &ip{}
JSON = &ownJSON{} JSON = &ownJSON{}
String = &stringOperate{} String = &stringOperate{}
Struct = &ownStruct{}
} }

View File

@ -9,12 +9,20 @@ package util
import "encoding/json" import "encoding/json"
// StructToMap 结构体转为map // ownStruct ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:19 2022/5/14
type ownStruct struct {
}
// ToMap 结构体转为map
// //
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>
// //
// Date : 11:12 下午 2021/3/14 // Date : 11:12 下午 2021/3/14
func StructToMap(data interface{}) (map[string]interface{}, error) { func (os *ownStruct) ToMap(data interface{}) (map[string]interface{}, error) {
var ( var (
byteData []byte byteData []byte
err error err error