Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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