update
This commit is contained in:
parent
3dff92188f
commit
4a5f73bb02
@ -14,8 +14,9 @@ import (
|
||||
|
||||
"github.com/tidwall/sjson"
|
||||
|
||||
"errors"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/util"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
|
@ -118,3 +118,43 @@ func TestNewFilterForArrayOne(t *testing.T) {
|
||||
fmt.Println(f.String())
|
||||
})
|
||||
}
|
||||
|
||||
// TestNewFilterForArrayTwo ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 22:22 2023/1/2
|
||||
func TestNewFilterForArrayTwo(t *testing.T) {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
testData := `{"user_list":[
|
||||
{
|
||||
"name":"zhangdeman1"
|
||||
},
|
||||
{
|
||||
"name":"zhang1"
|
||||
},
|
||||
{
|
||||
"name":"de1"
|
||||
},
|
||||
{
|
||||
"name":"man1"
|
||||
}
|
||||
]}`
|
||||
filterRuleList := []MapRule{
|
||||
{
|
||||
SourcePath: "user_list.[].name",
|
||||
MapPath: "user.name_list.[]",
|
||||
Required: true,
|
||||
DataType: "string",
|
||||
DefaultValue: "",
|
||||
},
|
||||
}
|
||||
f := NewFilter(testData, filterRuleList)
|
||||
convey.Convey("提取列表字段,构成新的列表", t, func() {
|
||||
err = f.Deal()
|
||||
convey.So(err, convey.ShouldEqual, nil)
|
||||
fmt.Println(f.String())
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user