Skip to content

C++ client library for InfluxDB 1.x/2.x build in Qt

License

Notifications You must be signed in to change notification settings

FlameAlpha/influxdb-cpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

influxdb-cpp

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

Installation

Build requirements: Qt 5.12.2 MSVC2017 64bit

Integrated development environment: Qt Creator 4.8.2

Dependencies: cURL, boost 1.57+

Quick start

Write

// 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)
);

Query

// 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;

Libary

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.

Transports

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>

About

C++ client library for InfluxDB 1.x/2.x build in Qt

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 99.7%
  • C 0.3%
  • Makefile 0.0%
  • HTML 0.0%
  • M4 0.0%
  • Perl 0.0%