- 添加Struct2MapByJson
- 去掉将全局structs.DefaultTagName设置为"json"
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user