gitee.com/zhongguo168a/gocodes@v0.0.0-20230609140523-e1828349603f/datax/mapx/map_test.go (about) 1 package mapx 2 3 import ( 4 "fmt" 5 "gitee.com/zhongguo168a/gocodes/datax" 6 "testing" 7 ) 8 9 func TestMapByPath(t *testing.T) { 10 m := map[string]interface{}{} 11 mPath := MapByPath(m, "/单位/key1") 12 mPath["任务数据"] = datax.M{} 13 fmt.Println("mPath", mPath) 14 } 15 func TestFlat(t *testing.T) { 16 m := map[string]interface{}{ 17 "a": map[string]interface{}{ 18 "b": map[string]interface{}{ 19 "c": "ok", 20 }, 21 }, 22 "arr": []interface{}{ 23 "b", "c", 24 }, 25 } 26 fmt.Println(Flat(m, true)) 27 }