influx-client 0.3.0

A Rust library to interact with InfluxDB
Documentation
// You can also read CSV records from InfluxDB.
// This crate treats all records as string records.
// If you want them parsed, take a look at the csv_records example.

use influx_client::{
    flux::functions::{NumericFilter, Range, StringFilter},
    Client, InfluxError, Precision, ReadQuery,
};

fn main() -> Result<(), InfluxError> {
    let client = Client::from_env("http://localhost:8086").expect("INFLUXDB_TOKEN not set");

    let q = ReadQuery::new("home")
        .range(Range::new(Some((-12, Precision::h)), None))
        .filter(StringFilter::Eq("_measurement", "test"))
        .filter(NumericFilter::Lt("_value", 99));

    let csv = client.get_csv("home", q)?;
    for rec in &csv {
        for (i, v) in rec.iter().enumerate() {
            println!("{}: {}", i, v);
        }
    }
    Ok(())
}