- 添加Struct2MapByJson

- 去掉将全局structs.DefaultTagName设置为"json"
This commit is contained in:
gazebo
2019-03-27 22:42:35 +08:00
parent 11c6386331
commit ea13a07fea
10 changed files with 26 additions and 23 deletions

View File

@@ -174,3 +174,14 @@ func TestTrimBlanChar(t *testing.T) {
t.Fatal("TrimBlanChar doesn't work")
}
}
func TestStruct2MapByJson(t *testing.T) {
mapData := Struct2MapByJson(&struct {
IntData int `structs:"dataInt"`
StrData string `json:"dataStr"`
}{
IntData: 1,
StrData: "2",
})
t.Log(mapData)
}