调整struct
This commit is contained in:
parent
8d84b733b8
commit
3b612857fe
3
init.go
3
init.go
@ -20,6 +20,8 @@ var (
|
||||
JSON *ownJSON
|
||||
// String ...
|
||||
String *stringOperate
|
||||
// Struct ...
|
||||
Struct *ownStruct
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -29,4 +31,5 @@ func init() {
|
||||
IP = &ip{}
|
||||
JSON = &ownJSON{}
|
||||
String = &stringOperate{}
|
||||
Struct = &ownStruct{}
|
||||
}
|
||||
|
12
struct.go
12
struct.go
@ -9,12 +9,20 @@ package util
|
||||
|
||||
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<白茶清欢>
|
||||
//
|
||||
// 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 (
|
||||
byteData []byte
|
||||
err error
|
||||
|
Loading…
Reference in New Issue
Block a user