Crates.io | influxdb-client |
lib.rs | influxdb-client |
version | 0.1.4 |
source | src |
created_at | 2021-02-28 22:25:17.425859 |
updated_at | 2021-03-04 18:00:24.565868 |
description | Rust client library for InfluxDB v2 |
homepage | |
repository | https://github.com/Andorr/influxdb-client-rs |
max_upload_size | |
id | 362014 |
size | 11,598 |
NB! - This library is still in development and is not ready for production!
An unofficial client-library for InfluxDB v2.
influxdb-client = "0.1.4"
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;
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;
This todolist is still in progress and will be expanded in the future.