Skip to content

Commit

Permalink
Release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Empty2k12 committed Mar 17, 2020
1 parent cb7f08c commit 7d6ad27
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 49 deletions.
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,43 @@ Pull requests are always welcome. See [Contributing](https://github.com/Empty2k1
Add the following to your `Cargo.toml`

```toml
influxdb = "0.0.6"
influxdb = { version = "0.1.0", features = ["derive"] }
```

For an example with using Serde deserialization, please refer to [serde_integration](crate::integrations::serde_integration)

```rust
use influxdb::{Client, Query, Timestamp};
use influxdb::InfluxDbWriteable;
use chrono::{DateTime, Utc};

// Create a Client with URL `http://localhost:8086`
// and database name `test`
// Connect to db `test` on `http://localhost:8086`
let client = Client::new("http://localhost:8086", "test");

// Let's write something to InfluxDB. First we're creating a
// WriteQuery to write some data.
// This creates a query which writes a new measurement into a series called `weather`
let write_query = Timestamp::Now.into_query("weather")
.add_field("temperature", 82);

// Submit the query to InfluxDB.
let write_result = client.query(&write_query).await;
#[derive(InfluxDbWriteable)]
struct WeatherReading {
time: DateTime<Utc>,
humidity: i32,
#[tag] wind_direction: String,
}

// 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 write_result = client
.query(&weather_reading.into_query("weather"))
.await;
assert!(write_result.is_ok(), "Write result was not okay");

// Reading data is as simple as writing. First we need to create a query
// Let's see if the data we wrote is there
let read_query = Query::raw_read_query("SELECT * FROM weather");

// submit the request and wait until it's done
let read_result = client.query(&read_query).await;

assert!(read_result.is_ok(), "Read result was not ok");

// We can be sure the result was successful, so we can unwrap the result to get
// the response String from InfluxDB
println!("{}", read_result.unwrap());
```

Expand Down
14 changes: 7 additions & 7 deletions influxdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "influxdb"
version = "0.0.6"
version = "0.1.0"
authors = ["Gero Gerke <[email protected]>"]
edition = "2018"
description = "InfluxDB Driver for Rust"
Expand All @@ -16,14 +16,14 @@ repository = "https://github.com/Empty2k12/influxdb-rust"
travis-ci = { repository = "Empty2k12/influxdb-rust", branch = "master" }

[dependencies]
chrono = { version = "0.4.10", features = ["serde"] }
failure = "0.1.6"
chrono = { version = "0.4.11", features = ["serde"] }
failure = "0.1.7"
futures = "0.3.4"
influxdb_derive = { version = "0.0.1", optional = true }
reqwest = { version = "0.10.1", features = ["json"] }
influxdb_derive = { version = "0.1.0", optional = true }
reqwest = { version = "0.10.4", features = ["json"] }
serde = { version = "1.0.104", features = ["derive"], optional = true }
serde_json = { version = "1.0.46", optional = true }
regex = "1.3.4"
serde_json = { version = "1.0.48", optional = true }
regex = "1.3.5"
lazy_static = "1.4.0"

[features]
Expand Down
1 change: 0 additions & 1 deletion influxdb/LICENSE

This file was deleted.

39 changes: 21 additions & 18 deletions influxdb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,46 @@
//! Add the following to your `Cargo.toml`
//!
//! ```toml
//! influxdb = "0.0.6"
//! influxdb = { version = "0.1.0", features = ["derive"] }
//! ```
//!
//! For an example with using Serde deserialization, please refer to [serde_integration](crate::integrations::serde_integration)
//!
//! ```rust,no_run
//! use influxdb::{Client, Query, Timestamp};
//! use influxdb::InfluxDbWriteable;
//! use chrono::{DateTime, Utc};
//!
//! # #[tokio::main]
//! # async fn main() {
//! // Create a Client with URL `http://localhost:8086`
//! // and database name `test`
//! // Connect to db `test` on `http://localhost:8086`
//! let client = Client::new("http://localhost:8086", "test");
//!
//! // Let's write something to InfluxDB. First we're creating a
//! // WriteQuery to write some data.
//! // This creates a query which writes a new measurement into a series called `weather`
//! let write_query = Timestamp::Now.into_query("weather")
//! .add_field("temperature", 82);
//!
//! // Submit the query to InfluxDB.
//! let write_result = client.query(&write_query).await;
//! #[derive(InfluxDbWriteable)]
//! struct WeatherReading {
//! time: DateTime<Utc>,
//! humidity: i32,
//! #[tag] wind_direction: String,
//! }
//!
//! // 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 write_result = client
//! .query(&weather_reading.into_query("weather"))
//! .await;
//! assert!(write_result.is_ok(), "Write result was not okay");
//!
//! // Reading data is as simple as writing. First we need to create a query
//! // Let's see if the data we wrote is there
//! let read_query = Query::raw_read_query("SELECT * FROM weather");
//!
//! // submit the request and wait until it's done
//! let read_result = client.query(&read_query).await;
//!
//! assert!(read_result.is_ok(), "Read result was not ok");
//!
//! // We can be sure the result was successful, so we can unwrap the result to get
//! // the response String from InfluxDB
//! println!("{}", read_result.unwrap());
//! # }
//! ```
//!
//! For further examples, check out the Integration Tests in `tests/integration_tests.rs`
Expand Down
8 changes: 4 additions & 4 deletions influxdb_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "influxdb_derive"
version = "0.0.1"
version = "0.1.0"
authors = ["Gero Gerke <[email protected]>"]
edition = "2018"
description = "InfluxDB Driver for Rust - Derive"
Expand All @@ -20,6 +20,6 @@ travis-ci = { repository = "Empty2k12/influxdb-rust", branch = "master" }
coveralls = { repository = "Empty2k12/influxdb-rust", branch = "master", service = "github" }

[dependencies]
proc-macro2 = "1.0.5"
quote = "1.0.2"
syn = { version = "1.0.5", features = ["extra-traits", "full"] }
proc-macro2 = "1.0.9"
quote = "1.0.3"
syn = { version = "1.0.16", features = ["extra-traits", "full"] }
1 change: 0 additions & 1 deletion influxdb_derive/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion influxdb_derive/README.md

This file was deleted.

28 changes: 28 additions & 0 deletions influxdb_derive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div align="center">
<br/>
<img
alt="rust-influxdb"
src="https://i.imgur.com/4k7l8XJ.png"
width=250px />
<br/>
<br/>
<strong>Derive Crate for <a href="https://crates.io/crates/influxdb">influxdb</a></strong>
</div>
<br/>
<p align="center">
<a href="https://crates.io/crates/influxdb">
<img src="https://img.shields.io/crates/v/influxdb.svg"/>
</a>
<a href="https://travis-ci.org/Empty2k12/influxdb-rust">
<img src="https://travis-ci.org/Empty2k12/influxdb-rust.svg?branch=master" alt='Build Status' />
</a>
<a href="https://docs.rs/crate/influxdb">
<img src="https://docs.rs/influxdb/badge.svg" alt='Documentation Status' />
</a>
<a href="https://www.rust-lang.org/en-US/">
<img src="https://img.shields.io/badge/Made%20with-Rust-orange.svg" alt='Build with Rust' />
</a>
<a href="https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html">
<img src="https://img.shields.io/badge/rustc-1.39+-yellow.svg" alt='Minimum Rust Version' />
</a>
</p>

0 comments on commit 7d6ad27

Please sign in to comment.