[Go] go连接influxdb的库
2023-02-18 15:41:07 时间
开启了influxdb后,会监听8086端口
下载客户端代码
git clone https://github.com/influxdata/influxdb1-client.git $GOPATH/src/github.com/influxdata/influxdb1-client
package main import ( "fmt" _ "github.com/influxdata/influxdb1-client" // this is important because of the bug in go mod client "github.com/influxdata/influxdb1-client/v2" ) func main() { c, err := client.NewHTTPClient(client.HTTPConfig{ Addr: "http://172.17.0.3:8086", }) if err != nil { fmt.Println("Error creating InfluxDB Client: ", err.Error()) } defer c.Close() q := client.NewQuery("SELECT *FROM webmail_log", "sinamail", "") if response, err := c.Query(q); err == nil && response.Error() == nil { fmt.Println(response.Results) } }
相关文章
- MongoDB 在评论中台的实践
- 使用mongodb作为Quartz.Net下的JobStore实现底层的持久化机制
- mongodb之使用explain和hint性能分析和优化
- mongodb 3.x 之实用新功能窥看[2] ——使用$lookup做多表关联处理
- mongodb 3.x 之实用新功能窥看[1] ——使用TTLIndex做Cache处理
- 双十一来了,别让你的mongodb宕机了
- GO语言开发环境搭建笔记
- PHP判断网络连通
- 开启phpMyAdmin的远程登录
- PHP_cURL初始化和执行方法
- PHP经典函数收集
- PHP所有函数列表
- php bbcode过滤
- php不使用中间变量交换两个变量的值
- 嵌入式:ARM异常中断指令SWI、BKPT、CLZ详解
- 嵌入式:ARM协处理器指令总结
- C++ 中的卷积神经网络 (CNN)
- 一个git仓库多个项目配置pre-commit代码校验
- 搭建PHP开发环境(PHPStorm+PHPStudy)
- 记一次git丢失代码找回