Giter Club home page Giter Club logo

influxdb-cpp's Introduction

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.