pub struct Client { /* private fields */ }
Expand description

Internal Representation of a Client

Implementations

Instantiates a new Client

Arguments
  • url: The URL where InfluxDB is running (ex. http://localhost:8086).
  • database: The Database against which queries and writes will be run.
Examples
use influxdb::Client;

let _client = Client::new("http://localhost:8086", "test");

Add authentication/authorization information to Client

Arguments
  • username: The Username for InfluxDB.
  • password: The Password for the user.
Examples
use influxdb::Client;

let _client = Client::new("http://localhost:9086", "test").with_auth("admin", "password");

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
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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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