Skip to content

Commit 7d6ad27

Browse files
committed
Release 0.1.0
1 parent cb7f08c commit 7d6ad27

File tree

7 files changed

+81
-49
lines changed

7 files changed

+81
-49
lines changed

README.md

+21-17
Original file line numberDiff line numberDiff line change
@@ -51,39 +51,43 @@ Pull requests are always welcome. See [Contributing](https://github.com/Empty2k1
5151
Add the following to your `Cargo.toml`
5252

5353
```toml
54-
influxdb = "0.0.6"
54+
influxdb = { version = "0.1.0", features = ["derive"] }
5555
```
5656

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

5959
```rust
6060
use influxdb::{Client, Query, Timestamp};
6161
use influxdb::InfluxDbWriteable;
62+
use chrono::{DateTime, Utc};
6263

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

67-
// Let's write something to InfluxDB. First we're creating a
68-
// WriteQuery to write some data.
69-
// This creates a query which writes a new measurement into a series called `weather`
70-
let write_query = Timestamp::Now.into_query("weather")
71-
.add_field("temperature", 82);
72-
73-
// Submit the query to InfluxDB.
74-
let write_result = client.query(&write_query).await;
67+
#[derive(InfluxDbWriteable)]
68+
struct WeatherReading {
69+
time: DateTime<Utc>,
70+
humidity: i32,
71+
#[tag] wind_direction: String,
72+
}
73+
74+
// Let's write some data into a measurement called `weather`
75+
let weather_reading = WeatherReading {
76+
time: Timestamp::Hours(1).into(),
77+
humidity: 30,
78+
wind_direction: String::from("north"),
79+
};
80+
81+
let write_result = client
82+
.query(&weather_reading.into_query("weather"))
83+
.await;
7584
assert!(write_result.is_ok(), "Write result was not okay");
7685

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

80-
// submit the request and wait until it's done
8189
let read_result = client.query(&read_query).await;
82-
8390
assert!(read_result.is_ok(), "Read result was not ok");
84-
85-
// We can be sure the result was successful, so we can unwrap the result to get
86-
// the response String from InfluxDB
8791
println!("{}", read_result.unwrap());
8892
```
8993

influxdb/Cargo.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

1818
[dependencies]
19-
chrono = { version = "0.4.10", features = ["serde"] }
20-
failure = "0.1.6"
19+
chrono = { version = "0.4.11", features = ["serde"] }
20+
failure = "0.1.7"
2121
futures = "0.3.4"
22-
influxdb_derive = { version = "0.0.1", optional = true }
23-
reqwest = { version = "0.10.1", features = ["json"] }
22+
influxdb_derive = { version = "0.1.0", optional = true }
23+
reqwest = { version = "0.10.4", features = ["json"] }
2424
serde = { version = "1.0.104", features = ["derive"], optional = true }
25-
serde_json = { version = "1.0.46", optional = true }
26-
regex = "1.3.4"
25+
serde_json = { version = "1.0.48", optional = true }
26+
regex = "1.3.5"
2727
lazy_static = "1.4.0"
2828

2929
[features]

influxdb/LICENSE

-1
This file was deleted.

influxdb/src/lib.rs

+21-18
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,46 @@
2222
//! Add the following to your `Cargo.toml`
2323
//!
2424
//! ```toml
25-
//! influxdb = "0.0.6"
25+
//! influxdb = { version = "0.1.0", features = ["derive"] }
2626
//! ```
2727
//!
2828
//! For an example with using Serde deserialization, please refer to [serde_integration](crate::integrations::serde_integration)
2929
//!
3030
//! ```rust,no_run
3131
//! use influxdb::{Client, Query, Timestamp};
3232
//! use influxdb::InfluxDbWriteable;
33+
//! use chrono::{DateTime, Utc};
3334
//!
3435
//! # #[tokio::main]
3536
//! # async fn main() {
36-
//! // Create a Client with URL `http://localhost:8086`
37-
//! // and database name `test`
37+
//! // Connect to db `test` on `http://localhost:8086`
3838
//! let client = Client::new("http://localhost:8086", "test");
3939
//!
40-
//! // Let's write something to InfluxDB. First we're creating a
41-
//! // WriteQuery to write some data.
42-
//! // This creates a query which writes a new measurement into a series called `weather`
43-
//! let write_query = Timestamp::Now.into_query("weather")
44-
//! .add_field("temperature", 82);
45-
//!
46-
//! // Submit the query to InfluxDB.
47-
//! let write_result = client.query(&write_query).await;
40+
//! #[derive(InfluxDbWriteable)]
41+
//! struct WeatherReading {
42+
//! time: DateTime<Utc>,
43+
//! humidity: i32,
44+
//! #[tag] wind_direction: String,
45+
//! }
46+
//!
47+
//! // Let's write some data into a measurement called `weather`
48+
//! let weather_reading = WeatherReading {
49+
//! time: Timestamp::Hours(1).into(),
50+
//! humidity: 30,
51+
//! wind_direction: String::from("north"),
52+
//! };
53+
//!
54+
//! let write_result = client
55+
//! .query(&weather_reading.into_query("weather"))
56+
//! .await;
4857
//! assert!(write_result.is_ok(), "Write result was not okay");
4958
//!
50-
//! // Reading data is as simple as writing. First we need to create a query
59+
//! // Let's see if the data we wrote is there
5160
//! let read_query = Query::raw_read_query("SELECT * FROM weather");
5261
//!
53-
//! // submit the request and wait until it's done
5462
//! let read_result = client.query(&read_query).await;
55-
//!
5663
//! assert!(read_result.is_ok(), "Read result was not ok");
57-
//!
58-
//! // We can be sure the result was successful, so we can unwrap the result to get
59-
//! // the response String from InfluxDB
6064
//! println!("{}", read_result.unwrap());
61-
//! # }
6265
//! ```
6366
//!
6467
//! For further examples, check out the Integration Tests in `tests/integration_tests.rs`

influxdb_derive/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

2222
[dependencies]
23-
proc-macro2 = "1.0.5"
24-
quote = "1.0.2"
25-
syn = { version = "1.0.5", features = ["extra-traits", "full"] }
23+
proc-macro2 = "1.0.9"
24+
quote = "1.0.3"
25+
syn = { version = "1.0.16", features = ["extra-traits", "full"] }

influxdb_derive/LICENSE

-1
This file was deleted.

influxdb_derive/README.md

-1
This file was deleted.

influxdb_derive/README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<div align="center">
2+
<br/>
3+
<img
4+
alt="rust-influxdb"
5+
src="https://i.imgur.com/4k7l8XJ.png"
6+
width=250px />
7+
<br/>
8+
<br/>
9+
<strong>Derive Crate for <a href="https://crates.io/crates/influxdb">influxdb</a></strong>
10+
</div>
11+
<br/>
12+
<p align="center">
13+
<a href="https://crates.io/crates/influxdb">
14+
<img src="https://img.shields.io/crates/v/influxdb.svg"/>
15+
</a>
16+
<a href="https://travis-ci.org/Empty2k12/influxdb-rust">
17+
<img src="https://travis-ci.org/Empty2k12/influxdb-rust.svg?branch=master" alt='Build Status' />
18+
</a>
19+
<a href="https://docs.rs/crate/influxdb">
20+
<img src="https://docs.rs/influxdb/badge.svg" alt='Documentation Status' />
21+
</a>
22+
<a href="https://www.rust-lang.org/en-US/">
23+
<img src="https://img.shields.io/badge/Made%20with-Rust-orange.svg" alt='Build with Rust' />
24+
</a>
25+
<a href="https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html">
26+
<img src="https://img.shields.io/badge/rustc-1.39+-yellow.svg" alt='Minimum Rust Version' />
27+
</a>
28+
</p>

0 commit comments

Comments
 (0)