增加基础类型的动态提取

This commit is contained in:
2021-04-13 21:53:36 +08:00
parent 6a35eb1a9d
commit 89349705fd
3 changed files with 46 additions and 4 deletions

View File

@ -48,3 +48,23 @@ func TestJSON(t *testing.T) {
func TestType(t *testing.T) {
}
// TestSelect 测试动态选择字段
//
// Author : go_developer@163.com<张德满>
//
// Date : 9:47 下午 2021/4/13
func TestSelect(t *testing.T) {
source := map[string]interface{}{
"name": "zhangdeman",
"extra": map[string]interface{}{
"age": 18,
"height": 180,
"slice": []int{1, 2, 3},
},
"slice": []int{1, 2, 3},
}
pathList := []string{"name", "extra.age", "slice"}
r, e := NewParseJSONTree(source).Parse(pathList)
fmt.Println(r.String(), e)
}