-
-
Save xNok/dd408b73e48318fef6334f07783f819b 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 write_event_with_fluent_Style(client influxdb2.Client, t ThermostatSetting) { | |
// Use blocking write client for writes to desired bucket | |
writeAPI := client.WriteAPI(org, bucket) | |
// create point using fluent style | |
p := influxdb2.NewPointWithMeasurement("thermostat"). | |
AddTag("unit", "temperature"). | |
AddTag("user", t.user). | |
AddField("avg", t.avg). | |
AddField("max", t.max). | |
SetTime(time.Now()) | |
writeAPI.WritePoint(p) | |
// Flush writes | |
writeAPI.Flush() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment