Code Monkey home page Code Monkey logo

influxdb-rs's Introduction

Influxdb-rs


Crates.io Build Status docs downloads issues license

TL;DR

InfluxDB Rust Client for Influx APIv2

Overview

This is the InfluxDB driver to be utilized with the Rust programming language. It is mainly ASYNC but will include future work to have synchronous actions as well. The driver is aimed to be used with the version 2 of the InfluxDB API. There can be backwards compatibility with the 1.x endpoints but that is not the true aim of this crate.

Status

  • HTTP Client
    • Use Token Auth
  • Server
    • Ping
    • Get Version
    • Get Org ID
    • Determine Aditional Capabilities
  • Measurements
    • Delete Measurements
    • Add Points
    • Add Measurements
    • Add Fields
    • Add Timestamps
    • Determine Additional Capabilities
  • Bucket
    • Create Bucket
    • Delete Bucket
    • Change Bucket
    • Determine Additional Capbilities
  • Rocket.rs Database Driver
  • Queries
    • Flux Queries
    • Determine Additional Capabilities
  • Tests
    • Auth Integration
    • Auth Unit
    • Write Integration
    • Write Unit
  • Backwards Compatibility
    • Basic Auth
    • 1.x Endpoint Query

Usage

Use

[dependencies]
influxdb_rs = "0.2"

http

use influxdb_rs::Client;
use url::Url;
use chrono::prelude::*;

#[tokio::main]
async fn main() {
    let client = Client::new(Url::parse("http://localhost:8086").unwrap(), "test_bucket", "test_org", "0123456789").await.unwrap();
    
    let now = Utc::now();

    let point = Point::new("temporary")
        .add_field("foo", "bar")
        .add_field("integer", 11)
        .add_field("float", 22.3)
        .add_field("'boolean'", false)
        .add_timestamp(now.timestamp());

    let result = client.write_point(point, Some(Precision::Seconds), None).await;
    if result.is_err(){
        // Error!
    }

    let later = Utc::now().to_rfc3339().to_string();

    client.drop_measurement("temporary", &now.to_rfc3339(), &later).await.unwrap();
}

Compatibility

InfluxDB APIv2 API Document

Tested:

  • OSS 2.3
  • OSS 2.2
  • OSS 2.1

Thanks

Because influxdbclient-rs only supported the 1.x version. I ended up reading influxdb2-client and influxdb-client-go source code and then wrote a library for 2.x API version for support for my own use. influxdb2-client; although functioning, was not published to crates so I opted to build my own. Enjoy!

influxdb-rs's People

Contributors

infosechoudini avatar jdicioccio avatar

Watchers

 avatar

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.