pub struct Client { /* private fields */ }
Expand description
Internal Representation of a Client
Implementations
Replaces the HTTP Client
Returns the name of the database the client is using
Returns the URL of the InfluxDB installation the client is using
Pings the InfluxDB Server
Returns a tuple of build type and version number
Sends a ReadQuery
or WriteQuery
to the InfluxDB Server.
A version capable of parsing the returned string is available under the serde_integration
Arguments
q
: Query of typeReadQuery
orWriteQuery
Examples
use influxdb::{Client, Query, Timestamp};
use influxdb::InfluxDbWriteable;
use std::time::{SystemTime, UNIX_EPOCH};
let start = SystemTime::now();
let since_the_epoch = start
.duration_since(UNIX_EPOCH)
.expect("Time went backwards")
.as_millis();
let client = Client::new("http://localhost:8086", "test");
let query = Timestamp::Milliseconds(since_the_epoch)
.into_query("weather")
.add_field("temperature", 82);
let results = client.query(query).await?;
Errors
If the function can not finish the query,
a Error
variant will be returned.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more