调整struct
This commit is contained in:
parent
8d84b733b8
commit
3b612857fe
3
init.go
3
init.go
@ -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{}
|
||||||
}
|
}
|
||||||
|
12
struct.go
12
struct.go
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user