新增测点配置

This commit is contained in:
2024-09-03 15:52:38 +08:00
parent bfb284c4cc
commit 3b53e9f9b7
37 changed files with 429 additions and 66 deletions

22
core/influxdb/influxdb.go Normal file
View File

@@ -0,0 +1,22 @@
package influxdb
import (
"energy-management-system/global"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
)
func InitInFluxDb() {
// Create a new client using an InfluxDB server base URL and an authentication token
client := influxdb2.NewClient(global.AppConf.InFluxDb.Host, global.AppConf.InFluxDb.Token)
// Use blocking write client for writes to desired bucket
//获取非阻塞式写入对象
//writeAPI = client.WriteAPI("my-org", "my-bucket")
//writeAPI := client.WriteAPIBlocking("my-org", "my-bucket")
//获取阻塞式写入对象
//writeBlockingAPI := client.WriteAPIBlocking("iuu", "iuu-bucket")
global.InFluxDb = client
}