pub struct Client<'a> { /* private fields */ }
Expand description
Use a Client to connect to your influx database and execute queries.
Implementations§
Source§impl<'a> Client<'a>
impl<'a> Client<'a>
Sourcepub fn new(url: &'a str, token: &'a str) -> Self
pub fn new(url: &'a str, token: &'a str) -> Self
Create a client with a given database URL and token.
Sourcepub fn from_env(url: &'a str) -> Result<Self, InfluxError>
pub fn from_env(url: &'a str) -> Result<Self, InfluxError>
Create a client that reads its token from the
INFLUXDB_TOKEN
environment variable
Sourcepub async fn insert<T: Display>(
&self,
bucket: &'a str,
org: &'a str,
precision: Precision,
query: WriteQuery<'a, T>,
) -> Result<(), InfluxError>
pub async fn insert<T: Display>( &self, bucket: &'a str, org: &'a str, precision: Precision, query: WriteQuery<'a, T>, ) -> Result<(), InfluxError>
Insert a new value into a bucket.
Note that not all attributes on WriteQuery
are supported yet.
Sourcepub async fn get(
&self,
org: &'a str,
query: ReadQuery<'a>,
) -> Result<String, InfluxError>
pub async fn get( &self, org: &'a str, query: ReadQuery<'a>, ) -> Result<String, InfluxError>
Retrieve a value from a bucket based on certain filters.
pub async fn get_csv( &self, org: &'a str, query: ReadQuery<'a>, ) -> Result<Vec<StringRecord>, InfluxError>
Auto Trait Implementations§
impl<'a> Freeze for Client<'a>
impl<'a> !RefUnwindSafe for Client<'a>
impl<'a> Send for Client<'a>
impl<'a> Sync for Client<'a>
impl<'a> Unpin for Client<'a>
impl<'a> !UnwindSafe for Client<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more