增加数组递归提取
This commit is contained in:
parent
5cc0d61e82
commit
db3fe19e6a
@ -173,7 +173,7 @@ func (df *DataFilter) formatRule() {
|
|||||||
}
|
}
|
||||||
// 数组层级深度不同,重新对对齐数据
|
// 数组层级深度不同,重新对对齐数据
|
||||||
diffArr := sourcePathArr[0 : len(sourcePathArr)-len(mapPathArr)+1]
|
diffArr := sourcePathArr[0 : len(sourcePathArr)-len(mapPathArr)+1]
|
||||||
if newPath := df.dealDiffArr(diffArr, sourcePathArr[len(sourcePathArr)-len(mapPathArr)-1:], mapPathArr); len(newPath) > 0 {
|
if newPath := df.dealDiffArr(diffArr); len(newPath) > 0 {
|
||||||
sourcePathArr[len(sourcePathArr)-len(mapPathArr)] = newPath
|
sourcePathArr[len(sourcePathArr)-len(mapPathArr)] = newPath
|
||||||
item.SourceKey = strings.Join(sourcePathArr[len(sourcePathArr)-len(mapPathArr):], ".[].")
|
item.SourceKey = strings.Join(sourcePathArr[len(sourcePathArr)-len(mapPathArr):], ".[].")
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ func (df *DataFilter) formatRule() {
|
|||||||
// Author : go_developer@163.com<白茶清欢>
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
//
|
//
|
||||||
// Date : 5:04 下午 2022/1/25
|
// Date : 5:04 下午 2022/1/25
|
||||||
func (df *DataFilter) dealDiffArr(diffArr []string, sourceAfterArr []string, mapArr []string) string {
|
func (df *DataFilter) dealDiffArr(diffArr []string) string {
|
||||||
if len(diffArr) == 0 {
|
if len(diffArr) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user