This repository contains the reference Rust client for the InfluxDB 2.0.
Add this to your Cargo.toml
:
[dependencies]
influxdb_client_rust = "1.0.0-alpha"
Use influxdb_client_rust::Client::new to create a client connected to a running InfluxDB 2 instance authenticate by token.
use influxdb_client_rust::Client;
let client = Client::new("http://localhost:9999", "my-token");
Option | Description | Type | Default |
---|---|---|---|
bucket | Default destination bucket for writes | String | none |
org | Default organization bucket for writes | String | none |
precision | Default precision for the unix timestamps within the body line-protocol | WritePrecision | ns |
Bucket
, Organization
and Precision
use influxdb_client_rust::Client;
use influxdb_client_rust::generated::models::WritePrecision;
let client = Client::new("http://localhost:9999", "my-token")
.with_bucket("my-bucket")
.with_org("my-org")
.with_precision(WritePrecision::S);
Use influxdb_client_rust::Client::new_v1 to create a client connected to InfluxDB 1.8.
use influxdb_client_rust::Client;
let client = Client::new_v1("http://localhost:8086",
"my-user",
"my-password",
"telegraf",
"autogen"
);
Bug reports and pull requests are welcome on GitHub at https://github.com/bonitoo-io/influxdb-client-rust.
The client is available as open source under the terms of the MIT License.