r移除struct
This commit is contained in:
parent
4ba9ec7c01
commit
024a0e5e96
3
init.go
3
init.go
@ -18,8 +18,6 @@ var (
|
||||
JSON *ownJSON
|
||||
// String ...
|
||||
String *stringOperate
|
||||
// Struct ...
|
||||
Struct *ownStruct
|
||||
// Calculate ...
|
||||
Calculate *calculate
|
||||
// Project ...
|
||||
@ -40,7 +38,6 @@ func init() {
|
||||
Hash = &hash{}
|
||||
JSON = &ownJSON{}
|
||||
String = &stringOperate{}
|
||||
Struct = &ownStruct{}
|
||||
Calculate = &calculate{}
|
||||
Project = &project{}
|
||||
Array = &array{}
|
||||
|
38
struct.go
38
struct.go
@ -1,38 +0,0 @@
|
||||
// Package util ...
|
||||
//
|
||||
// Description : util ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021-03-14 11:11 下午
|
||||
package util
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// 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 (os *ownStruct) ToMap(data interface{}) (map[string]interface{}, error) {
|
||||
var (
|
||||
byteData []byte
|
||||
err error
|
||||
result map[string]interface{}
|
||||
)
|
||||
if byteData, err = json.Marshal(data); nil != err {
|
||||
return nil, err
|
||||
}
|
||||
if err = json.Unmarshal(byteData, &result); nil != err {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user