It is forked from awegrzyn/influxdb-cxx, and I also modified some bug (about time and query) in this project, and transplant it to QT project
InfluxDB C++ client library
- Writing points
- Batch write
- Data exploration
- Supported transports
- HTTP/HTTPS with Basic Auth
Build requirements: Qt 5.12.2 MSVC2017 64bit
Integrated development environment: Qt Creator 4.8.2
Dependencies: cURL, boost 1.57+
// Provide complete URI
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)
);
// Available over HTTP only
auto influxdb = influxdb::InfluxDBFactory::Get("http://localhost:8086/?db=test");
/// Pass an IFQL to get list of points
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 : " << points.back().getTimestamp().time_since_epoch().count() << std::endl;
libcurl.lib
libboost_regex-vc141-mt-x64-1_67.lib
libboost_system-vc141-mt-x64-1_67.lib
libboost_date_time-vc141-mt-x64-1_67.lib
All of them were placed in the ./lib
folder.
An underlying transport is fully configurable by passing an URI:
[protocol]://[username:password@]host:port[/?db=database]
List of supported transport is following:
Name | Dependency | URI protocol | Sample URI |
---|---|---|---|
HTTP | cURL | http /https |
http://localhost:8086/?db=<db> |