]> 127.0.0.1 Git - part/.git/commitdiff
30
authorqydysky <qydysky@foxmail.com>
Mon, 3 Aug 2020 06:43:29 +0000 (14:43 +0800)
committerqydysky <qydysky@foxmail.com>
Mon, 3 Aug 2020 06:43:29 +0000 (14:43 +0800)
Json.go

diff --git a/Json.go b/Json.go
index b07669f466cb280c16d897d55d513e8b5fb5f6a0..32024d51a39ef476fa12f54342954c0af3bd9fec 100644 (file)
--- 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