-
-
Save xNok/d302361ddbf679278580fded73fbd5b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func read_events_as_raw_string(client influxdb2.Client) { | |
// Get query client | |
queryAPI := client.QueryAPI(org) | |
// Query | |
fluxQuery := fmt.Sprintf(`from(bucket: "users_business_events") | |
|> range(start: -1h) | |
|> filter(fn: (r) => r["_measurement"] == "thermostat") | |
|> yield(name: "mean")`) | |
result, err := queryAPI.QueryRaw(context.Background(), fluxQuery, influxdb2.DefaultDialect()) | |
if err == nil { | |
fmt.Println("QueryResult:") | |
fmt.Println(result) | |
} else { | |
panic(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment