Skip to content

Commit

Permalink
fix: if multiple jq resultsexist return all
Browse files Browse the repository at this point in the history
  • Loading branch information
Kav91 committed Jun 9, 2021
1 parent e861066 commit 1d9e4f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/processor/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func runJq(dataSets interface{}, api load.API) []interface{} {
return []interface{}{}
}

tempDataSets := []interface{}{}

iter := query.Run(dataSets)
for {
v, ok := iter.Next()
Expand All @@ -101,7 +103,7 @@ func runJq(dataSets interface{}, api load.API) []interface{} {
case []interface{}:
return value
case map[string]interface{}:
return []interface{}{value}
tempDataSets = append(tempDataSets, value)
case error:
load.Logrus.WithFields(logrus.Fields{
"api": api.Name,
Expand All @@ -112,5 +114,5 @@ func runJq(dataSets interface{}, api load.API) []interface{} {

}

return []interface{}{}
return tempDataSets
}

0 comments on commit 1d9e4f8

Please sign in to comment.