0 Star 1 Fork 0

魏士杰/influxdb-cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
example.cpp 831 Bytes
一键复制 编辑 原始数据 按行查看 历史
Flame 提交于 2020-02-12 18:06 . add query
#include <iostream>
#include "InfluxDBFactory.h"
#include "Point.h"
int main(){
auto influxdb = influxdb::InfluxDBFactory::Get("http://admin:admin@localhost:8086/?db=mydb");
influxdb->write(influxdb::Point{ "cpu" }
.addTag("host", "localhost")
.addTag("region", "china")
.addField("north_latitude", 36)
.addField("east_longitude", 114)
);
std::cout << "write over!" << std::endl;
auto points = influxdb->query("SELECT * FROM cpu");
std::cout << "query over!" << std::endl;
std::cout << "name : " << points.back().getName() <<std::endl
<< "field : "<<points.back().getFields() << std::endl
<< "timestamp : " << std::chrono::duration_cast<std::chrono::microseconds>(points.back().getTimestamp().time_since_epoch()).count() << std::endl;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/flamealpha/influxdb-cpp.git
git@gitee.com:flamealpha/influxdb-cpp.git
flamealpha
influxdb-cpp
influxdb-cpp
master

搜索帮助