Struct influxdb::client::InfluxDbClient
source · [−]pub struct InfluxDbClient { /* private fields */ }
Expand description
Internal Representation of a Client
Implementations
sourceimpl InfluxDbClient
impl InfluxDbClient
sourcepub fn new<S1, S2>(url: S1, database: S2) -> Self where
S1: ToString,
S2: ToString,
pub fn new<S1, S2>(url: S1, database: S2) -> Self where
S1: ToString,
S2: ToString,
Instantiates a new InfluxDbClient
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::InfluxDbClient;
let _client = InfluxDbClient::new("http://localhost:8086", "test");
sourcepub fn database_name(&self) -> &str
pub fn database_name(&self) -> &str
Returns the name of the database the client is using
sourcepub fn database_url(&self) -> &str
pub fn database_url(&self) -> &str
Returns the URL of the InfluxDB installation the client is using
sourcepub fn ping(
&self
) -> impl Future<Item = (String, String), Error = InfluxDbError>
pub fn ping(
&self
) -> impl Future<Item = (String, String), Error = InfluxDbError>
Pings the InfluxDB Server
Returns a tuple of build type and version number
sourcepub fn query<Q>(
&self,
q: Q
) -> Box<dyn Future<Item = String, Error = InfluxDbError>> where
Q: InfluxDbQuery,
pub fn query<Q>(
&self,
q: Q
) -> Box<dyn Future<Item = String, Error = InfluxDbError>> where
Q: InfluxDbQuery,
Sends a InfluxDbReadQuery
or InfluxDbWriteQuery
to the InfluxDB Server.InfluxDbError
A version capable of parsing the returned string is available under the serde_integration
Arguments
q
: Query of typeInfluxDbReadQuery
orInfluxDbWriteQuery
Examples
use influxdb::client::InfluxDbClient;
use influxdb::query::InfluxDbQuery;
let client = InfluxDbClient::new("http://localhost:8086", "test");
let _future = client.query(
InfluxDbQuery::write_query("weather")
.add_field("temperature", 82)
);
sourceimpl InfluxDbClient
impl InfluxDbClient
pub fn json_query<T: 'static>(
&self,
q: InfluxDbReadQuery
) -> Box<dyn Future<Item = Option<Vec<InfluxDbSeries<T>>>, Error = InfluxDbError>> where
T: DeserializeOwned,
Auto Trait Implementations
impl RefUnwindSafe for InfluxDbClient
impl Send for InfluxDbClient
impl Sync for InfluxDbClient
impl Unpin for InfluxDbClient
impl UnwindSafe for InfluxDbClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more