From 1db81782c12a04d26edbf7c8cb5bbe4ddddd510f Mon Sep 17 00:00:00 2001 From: qydysky Date: Mon, 3 Aug 2020 14:43:29 +0800 Subject: [PATCH] 30 --- Json.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Json.go b/Json.go index b07669f..32024d5 100644 --- a/Json.go +++ b/Json.go @@ -16,4 +16,21 @@ func (*json) GetValFrom(file,key string)interface {}{ jq = gojsonq.New().FromString(file) } return jq.Find(key) +} + +func (this *json) GetMultiValFrom(file string,key []string) []interface{}{ + var jq *gojsonq.JSONQ + if Checkfile().IsExist(file) { + jq = gojsonq.New().File(file) + }else{ + jq = gojsonq.New().FromString(file) + } + + var returnVal []interface{} + for _,i := range key { + jq.Reset() + returnVal = append(returnVal,jq.Find(i)) + } + + return returnVal } \ No newline at end of file -- 2.39.2