Giter Club home page Giter Club logo

influxdb-client-rs's Introduction

🦀 InfluxDB Rust Client

tests docs

NB! - This library is still in development and is not ready for production!

An unofficial client-library for InfluxDB v2.

⬇️ Installation

influxdb-client = "0.1.4"

❤️‍🔥 Usage

Insert by building a Point

use influxdb_client::{Client, Point, Precision, TimestampOptions};

let client = Client::new("http://localhost:8086", "token")
    .with_org_id("168f31904923e853")
    .with_bucket("tradely")
    .with_precision(Precision::MS);

let point = Point::new("test")
    .tag("ticker", "GME")
    .field("price", 420.69)
    .timestamp(1614956250000);

let points = vec![point];

// Insert with the timestamp from the point (1614956250000)
let result = client.insert_points(&points, TimestampOptions::FromPoint).await;

Insert using a struct

use influxdb_client::{Client, Precision, PointSerialize, TimestampOptions, Timestamp};
use influxdb_client::derives::PointSerialize;

let client = Client::new("http://localhost:8086", "token")
    .with_org_id("168f31904923e853")
    .with_bucket("tradely")
    .with_precision(Precision::MS);

#[derive(PointSerialize)]
#[point(measurement = "test")]
struct Ticker {
    #[point(tag)]
    ticker: String,
    #[point(field = "tickerPrice")]
    price: f64,
    #[point(timestamp)]
    timestamp: Timestamp,
}

let point = Ticker {
    ticker: String::from("GME"),
    price: 420.69,
    timestamp: Timestamp::from(1614956250000)
};

let points = vec![point];

// Insert without timestamp - InfluxDB will automatically set the timestamp
let result = client.insert_points(&points, TimestampOptions::None).await;

🪧 TODO

This todolist is still in progress and will be expanded in the future.

  • Implement insertion into InfluxDB from client
  • Implement procedural macro for implementing PointSerialize
  • Implement querying
  • Implement other important things

influxdb-client-rs's People

Contributors

andorr avatar sveinungoverland 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.