gjson+sjson hack升级 #8

Merged
zhangdeman merged 6 commits from feature/sjson_hack into master 2024-12-05 18:50:07 +08:00
Showing only changes of commit f61f9b28b1 - Show all commits

View File

@ -321,6 +321,20 @@ func Get(gjsonResult gjson.Result, path string) gjson.Result {
return gjsonResult
}
// GetMany 兼容 gjson GetMany 方法
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:32 2024/12/5
func GetMany(jsonStr string, pathList ...string) []gjson.Result {
res := make([]gjson.Result, 0)
gjsonResult := gjson.Parse(jsonStr)
for _, itemPath := range pathList {
res = append(res, Get(gjsonResult, itemPath))
}
return res
}
// IsSpecialPath 判断传入的是否为特殊路径
//
// Author : go_developer@163.com<白茶清欢>