fix flux query
This commit is contained in:
parent
877a46b9bf
commit
3d261df142
2 changed files with 1 additions and 4 deletions
|
@ -66,8 +66,6 @@ func (api *weatherRestApi) getData(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
fmt.Println(query)
|
||||
|
||||
data, err := api.weaterStorage.GetData(query)
|
||||
if err != nil {
|
||||
http.Error(w, "", http.StatusBadRequest)
|
||||
|
|
|
@ -80,8 +80,7 @@ func (storage *influxStorage) GetData(query *WeatherQuery) ([]*WeatherData, erro
|
|||
|
||||
fields = fmt.Sprintf(" and ( %v )", fields)
|
||||
|
||||
fluxQuery := fmt.Sprintf("from(bucket:\"%v\")|> range(start: %v, stop: %v) |> filter(fn: (r) => r._measurement == \"%v\" %v)", storage.bucket, query.Start.Format(time.RFC3339), query.End.Format(time.RFC3339), storage.measurement, fields)
|
||||
fmt.Println(fluxQuery)
|
||||
fluxQuery := fmt.Sprintf("from(bucket:\"%v\")|> range(start: %v, stop: %v) |> filter(fn: (r) => r._measurement == \"%v\" and r.sensorId == \"%v\" %v)", storage.bucket, query.Start.Format(time.RFC3339), query.End.Format(time.RFC3339), storage.measurement, query.SensorId, fields)
|
||||
|
||||
res, err := storage.executeFluxQuery(fluxQuery)
|
||||
return res, err
|
||||
|
|
Loading…
Add table
Reference in a new issue