Compare commits
2 Commits
51808626a9
...
5cc0d61e82
Author | SHA1 | Date | |
---|---|---|---|
5cc0d61e82 | |||
cd11f3c699 |
@ -14,7 +14,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.zhangdeman.cn/zhangdeman/gopkg/util"
|
"git.zhangdeman.cn/zhangdeman/gopkg/util"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
@ -174,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); len(newPath) > 0 {
|
if newPath := df.dealDiffArr(diffArr, sourcePathArr[len(sourcePathArr)-len(mapPathArr)-1:], mapPathArr); 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):], ".[].")
|
||||||
}
|
}
|
||||||
@ -203,11 +202,10 @@ 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) string {
|
func (df *DataFilter) dealDiffArr(diffArr []string, sourceAfterArr []string, mapArr []string) string {
|
||||||
if len(diffArr) == 0 {
|
if len(diffArr) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
diffArrStr := strings.Join(diffArr, ".[].")
|
diffArrStr := strings.Join(diffArr, ".[].")
|
||||||
if _, exist := df.hasDealDiffPath[diffArrStr]; exist {
|
if _, exist := df.hasDealDiffPath[diffArrStr]; exist {
|
||||||
// 已经处理过, 不再重复处理
|
// 已经处理过, 不再重复处理
|
||||||
|
Loading…
Reference in New Issue
Block a user