Skip to content

Commit 60526fe

Browse files
committed
Updating README.md to reflect bulk write capability added in influxdb-rs#87
1 parent 9a7b24b commit 60526fe

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

README.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Pull requests are always welcome. See [Contributing](https://github.com/influxdb
4040
- Reading and Writing to InfluxDB
4141
- Optional Serde Support for Deserialization
4242
- Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`)
43+
- Writing single or multiple measurements in one request (e.g. `WriteQuery` or `Vec<WriteQuery>` argument)
4344
- Authenticated and Unauthenticated Connections
4445
- `async`/`await` support
4546
- `#[derive(InfluxDbWriteable)]` Derive Macro for Writing / Reading into Structs
@@ -76,14 +77,21 @@ async fn main() {
7677
}
7778

7879
// Let's write some data into a measurement called `weather`
79-
let weather_reading = WeatherReading {
80-
time: Timestamp::Hours(1).into(),
81-
humidity: 30,
82-
wind_direction: String::from("north"),
83-
};
80+
let weather_readings = vec!(
81+
WeatherReading {
82+
time: Timestamp::Hours(1).into(),
83+
humidity: 30,
84+
wind_direction: String::from("north"),
85+
}.into_query("weather"),
86+
WeatherReading {
87+
time: Timestamp::Hours(2).into(),
88+
humidity: 40,
89+
wind_direction: String::from("west"),
90+
}.into_query("weather"),
91+
);
8492

8593
let write_result = client
86-
.query(weather_reading.into_query("weather"))
94+
.query(weather_readings)
8795
.await;
8896
assert!(write_result.is_ok(), "Write result was not okay");
8997

influxdb/src/lib.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//! - Reading and Writing to InfluxDB
99
//! - Optional Serde Support for Deserialization
1010
//! - Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`)
11+
//! - Writing single or multiple measurements in one request (e.g. `WriteQuery` or `Vec<WriteQuery>` argument)
1112
//! - Authenticated and Unauthenticated Connections
1213
//! - `async`/`await` support
1314
//! - `#[derive(InfluxDbWriteable)]` Derive Macro for Writing / Reading into Structs
@@ -44,14 +45,21 @@
4445
//! }
4546
//!
4647
//! // Let's write some data into a measurement called `weather`
47-
//! let weather_reading = WeatherReading {
48-
//! time: Timestamp::Hours(1).into(),
49-
//! humidity: 30,
50-
//! wind_direction: String::from("north"),
51-
//! };
48+
//! let weather_readings = vec!(
49+
//! WeatherReading {
50+
//! time: Timestamp::Hours(1).into(),
51+
//! humidity: 30,
52+
//! wind_direction: String::from("north"),
53+
//! }.into_query("weather"),
54+
//! WeatherReading {
55+
//! time: Timestamp::Hours(2).into(),
56+
//! humidity: 40,
57+
//! wind_direction: String::from("west"),
58+
//! }.into_query("weather"),
59+
//! );
5260
//!
5361
//! let write_result = client
54-
//! .query(weather_reading.into_query("weather"))
62+
//! .query(weather_readings)
5563
//! .await;
5664
//! assert!(write_result.is_ok(), "Write result was not okay");
5765
//!

0 commit comments

Comments
 (0)