Crate influx_db_client[][src]

Expand description

InfluxDB Client

InfluxDB is an open source time series database with no external dependencies. It’s useful for recording metrics, events, and performing analytics.



use influx_db_client::{Client, Point, Points, Value, Precision};

// default with "", db with "test"
let client = Client::default().set_authentication("root", "root");

let mut point = point!("test1");
let point = point
      .add_field("foo", Value::String("bar".to_string()))
      .add_field("integer", Value::Integer(11))
      .add_field("float", Value::Float(22.3))
      .add_field("'boolean'", Value::Boolean(false));

let point1 = Point::new("test1")
      .add_tag("tags", Value::String(String::from("\\\"fda")))
      .add_tag("number", Value::Integer(12))
      .add_tag("float", Value::Float(12.6))
      .add_field("fd", Value::String("'3'".to_string()))
      .add_field("quto", Value::String("\\\"fda".to_string()))
      .add_field("quto1", Value::String("\"fda".to_string()));

let points = points!(point1, point);

// if Precision is None, the default is second
// Multiple write
client.write_points(points, Some(Precision::Seconds), None).unwrap();

// query, it's type is Option<Vec<Node>>
let res = client.query("select * from test1", None).unwrap();
println!("{:?}", res.unwrap()[0].series)


use influx_db_client::{UdpClient, Point, Value};

let mut udp = UdpClient::new("".parse().unwrap());

let mut point = point!("test");
point.add_field("foo", Value::String(String::from("bar")));



pub use client::Client;
pub use client::UdpClient;
pub use error::Error;
pub use keys::ChunkedQuery;
pub use keys::Node;
pub use keys::Point;
pub use keys::Points;
pub use keys::Precision;
pub use keys::Query;
pub use keys::Series;
pub use keys::Value;
pub use reqwest;


All API on influxdb client, Including udp, http

Error module

Points and Query Data Deserialize


Create Point by macro

Create Points by macro