Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from jalapeno-api-gateway/influx-queries
Browse files Browse the repository at this point in the history
Fixed InfluxDB QueryBuilder
  • Loading branch information
mbongard authored Feb 28, 2022
2 parents e6d5c2e + 39eeead commit 21aa385
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions influxdb/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ func Fetch(logger *logrus.Entry, request *jagw.TelemetryRequest) []string {
}

func formatSelection(properties []string) string {
if len(properties) == 0 {
return "*"
}

var b strings.Builder
for i, property := range properties {
b.Reset()
Expand Down Expand Up @@ -141,10 +145,10 @@ func formatFilters(request *jagw.TelemetryRequest) string {
if request.RangeFilter == nil {
return b.String() + " limit 1"
} else {
if len(request.StringFilters) > 0 {
if b.Len() > 0 {
formatRangeFilter(" AND ", &b, request.RangeFilter)
} else {
formatRangeFilter(" ", &b, request.RangeFilter)
formatRangeFilter("WHERE ", &b, request.RangeFilter)

}
return b.String()
Expand Down

0 comments on commit 21aa385

Please sign in to comment.