1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//! # influxdb3-client
//!
//! Async Rust client for **InfluxDB 3 Core** and **InfluxDB 3 Enterprise**.
//!
//! Modelled after the official
//! [Go](https://github.com/InfluxCommunity/influxdb3-go) and
//! [Python](https://github.com/InfluxCommunity/influxdb3-python) clients:
//! identical feature set, idiomatic Rust API.
//!
//! ## Quick start
//!
//! ```rust,no_run
//! use influxdb3_client::{Client, ClientConfig, Point, Precision};
//!
//! #[tokio::main]
//! async fn main() -> influxdb3_client::Result<()> {
//! let client = Client::new(
//! ClientConfig::builder()
//! .host("https://cluster.example.io")
//! .token("my-api-token")
//! .database("sensors")
//! .build()?,
//! ).await?;
//!
//! // Write points: chain options, then await.
//! let points = vec![
//! Point::new("temperature")
//! .tag("location", "office")
//! .field("value", 22.5_f64)
//! .field("humidity", 48_i64),
//! ];
//! client.write(points)
//! .precision(Precision::Millisecond)
//! .await?;
//!
//! // Raw line protocol (low-level escape hatch)
//! client.write("cpu,host=srv1 usage=0.72").await?;
//!
//! // Query with SQL. `.sql()` is shorthand for `.query(q, QueryType::Sql)`.
//! let result = client
//! .sql("SELECT * FROM temperature ORDER BY time DESC LIMIT 10")
//! .await?;
//!
//! for row in result {
//! let row = row?;
//! println!("{} = {}", row["location"], row["value"]);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Streaming millions of rows
//!
//! For results too large to materialise in memory, use `.stream()` on a query
//! builder. The gRPC channel is consumed lazily as batches are polled:
//!
//! ```rust,no_run
//! # use influxdb3_client::Client;
//! # use futures_util::TryStreamExt;
//! # async fn example(client: &Client) -> influxdb3_client::Result<()> {
//! let mut stream = client.sql("SELECT * FROM huge_table").stream().await?;
//! while let Some(batch) = stream.try_next().await? {
//! // batch is an Arrow RecordBatch; process columns directly
//! println!("got {} rows", batch.num_rows());
//! }
//! # Ok(()) }
//! ```
//!
//! ## High-throughput writes
//!
//! For sustained ingest (flight-test telemetry, IIoT4.0 PLC streams), tune the
//! batch size and inflight window:
//!
//! ```rust,no_run
//! # use influxdb3_client::{Client, Point};
//! # async fn example(client: &Client, points: Vec<Point>) -> influxdb3_client::Result<()> {
//! client.write(points)
//! .batch_size(10_000)
//! .max_inflight(8)
//! .no_sync() // skip WAL sync for higher throughput
//! .gzip_threshold(None) // skip gzip on a fast LAN where bandwidth isn't the bottleneck
//! .await?;
//! # Ok(()) }
//! ```
pub use ;
pub use ;
pub use ;
pub use BatchStream;
pub use ;
pub use Precision;
pub use ;
pub use RetryConfig;
pub use ;
/// Convenience alias for `std::result::Result<T, Error>`.
pub type Result<T> = Result;