pub struct Client { /* private fields */ }Expand description
Async client for InfluxDB 3 Core and Enterprise.
See the crate-level docs for end-to-end examples.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn new(config: ClientConfig) -> Result<Self>
pub async fn new(config: ClientConfig) -> Result<Self>
Create a client from a ClientConfig.
The Arrow Flight gRPC channel is opened lazily on the first query call, so this constructor never fails due to gRPC connectivity.
Sourcepub async fn from_connection_string(cs: &str) -> Result<Self>
pub async fn from_connection_string(cs: &str) -> Result<Self>
Parse a connection string and create a client.
Sourcepub async fn from_env() -> Result<Self>
pub async fn from_env() -> Result<Self>
Read INFLUX_HOST, INFLUX_TOKEN, and INFLUX_DATABASE from the
environment and create a client.
Sourcepub fn config(&self) -> &ClientConfig
pub fn config(&self) -> &ClientConfig
Return a reference to the underlying config.
Sourcepub fn write<W: WriteInput>(&self, data: W) -> WriteRequest<'_, W>
pub fn write<W: WriteInput>(&self, data: W) -> WriteRequest<'_, W>
Start a write request.
data may be any WriteInput: a &str / String of pre-formatted
line protocol, a Vec<Point> / &[Point], a DataFrameWrite (polars
feature), or your own type that implements the trait.
Returns a WriteRequest builder; chain options, then .await.
See the crate-level docs for examples.
Sourcepub fn sql(&self, q: impl Into<String>) -> QueryRequest<'_>
pub fn sql(&self, q: impl Into<String>) -> QueryRequest<'_>
Start a SQL query. Sugar for query(q, QueryType::Sql).
Sourcepub fn influxql(&self, q: impl Into<String>) -> QueryRequest<'_>
pub fn influxql(&self, q: impl Into<String>) -> QueryRequest<'_>
Start an InfluxQL query. Sugar for query(q, QueryType::InfluxQL).
Sourcepub fn query(
&self,
q: impl Into<String>,
language: QueryType,
) -> QueryRequest<'_>
pub fn query( &self, q: impl Into<String>, language: QueryType, ) -> QueryRequest<'_>
Start a query. Returns a QueryRequest builder.
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request