Skip to content

Commit

Permalink
Updating README.md to reflect bulk write capability added in influxdb…
Browse files Browse the repository at this point in the history
  • Loading branch information
sdether committed Jun 15, 2022
1 parent 9a7b24b commit 749f439
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Pull requests are always welcome. See [Contributing](https://github.com/influxdb
- Reading and Writing to InfluxDB
- Optional Serde Support for Deserialization
- Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`)
- Writing single or multiple measurements in one request (e.g. `WriteQuery` or `Vec<WriteQuery>` argument)
- Authenticated and Unauthenticated Connections
- `async`/`await` support
- `#[derive(InfluxDbWriteable)]` Derive Macro for Writing / Reading into Structs
Expand Down Expand Up @@ -76,14 +77,21 @@ async fn main() {
}

// Let's write some data into a measurement called `weather`
let weather_reading = WeatherReading {
time: Timestamp::Hours(1).into(),
humidity: 30,
wind_direction: String::from("north"),
};
let weather_readings = vec!(
WeatherReading {
time: Timestamp::Hours(1).into(),
humidity: 30,
wind_direction: String::from("north"),
}.into_query("weather"),
WeatherReading {
time: Timestamp::Hours(2).into(),
humidity: 40,
wind_direction: String::from("west"),
}.into_query("weather"),
);

let write_result = client
.query(weather_reading.into_query("weather"))
.query(weather_readings)
.await;
assert!(write_result.is_ok(), "Write result was not okay");

Expand Down
20 changes: 14 additions & 6 deletions influxdb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//! - Reading and Writing to InfluxDB
//! - Optional Serde Support for Deserialization
//! - Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`)
//! - Writing single or multiple measurements in one request (e.g. `WriteQuery` or `Vec<WriteQuery>` argument)
//! - Authenticated and Unauthenticated Connections
//! - `async`/`await` support
//! - `#[derive(InfluxDbWriteable)]` Derive Macro for Writing / Reading into Structs
Expand Down Expand Up @@ -44,14 +45,21 @@
//! }
//!
//! // Let's write some data into a measurement called `weather`
//! let weather_reading = WeatherReading {
//! time: Timestamp::Hours(1).into(),
//! humidity: 30,
//! wind_direction: String::from("north"),
//! };
//! let weather_readings = vec!(
//! WeatherReading {
//! time: Timestamp::Hours(1).into(),
//! humidity: 30,
//! wind_direction: String::from("north"),
//! }.into_query("weather"),
//! WeatherReading {
//! time: Timestamp::Hours(2).into(),
//! humidity: 40,
//! wind_direction: String::from("west"),
//! }.into_query("weather"),
//! );
//!
//! let write_result = client
//! .query(weather_reading.into_query("weather"))
//! .query(weather_readings)
//! .await;
//! assert!(write_result.is_ok(), "Write result was not okay");
//!
Expand Down

0 comments on commit 749f439

Please sign in to comment.