Skip to content

Commit 2e530b2

Browse files
committed
Prepare for Release
1 parent 8b84549 commit 2e530b2

File tree

4 files changed

+138
-3
lines changed

4 files changed

+138
-3
lines changed

Cargo.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ name = "influxdb"
33
version = "0.0.1"
44
authors = ["Gero Gerke <[email protected]>"]
55
edition = "2018"
6+
description = "InfluxDB Driver for Rust"
7+
keywords = ["influxdb", "time series database", "influx"]
8+
license = "MIT"
9+
license-file = "LICENSE.md"
10+
readme = "README.md"
11+
include = ["src/**/*", "tests/**/*", "Cargo.toml", "LICENSE"]
12+
repository = "https://github.com/Empty2k12/influxdb-rust"
13+
14+
[badges]
15+
travis-ci = { repository = "Empty2k12/influxdb-rust", branch = "master" }
16+
coveralls = { repository = "Empty2k12/influxdb-rust", branch = "master", service = "github" }
617

718
[dependencies]
819
reqwest = "0.9.17"
@@ -15,5 +26,4 @@ serde_json = { version = "1.0", optional = true }
1526

1627
[features]
1728
use-serde = ["serde", "serde_json"]
18-
1929
default = ["use-serde"]

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2019 Gero Gerke https://gero.dev/
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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>Unofficial InfluxDB Driver for Rust</strong>
10+
</div>
11+
<br/>
12+
<p align="center">
13+
<a href="https://travis-ci.org/Empty2k12/influxdb-rust">
14+
<img src="https://travis-ci.org/Empty2k12/influxdb-rust.svg?branch=master" alt='Build Status' />
15+
</a>
16+
<a href="https://coveralls.io/github/Empty2k12/influxdb-rust?branch=master">
17+
<img src="https://coveralls.io/repos/github/Empty2k12/influxdb-rust/badge.svg?branch=master" alt='Coverage 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+
</p>
26+
27+
This library is a work in progress. Although we've been using it in production at [OpenVelo](https://openvelo.org/),
28+
we're prioritized features that fit our use cases. This means a feature you might need is not implemented
29+
yet or could be handled better.
30+
31+
Pull requests are always welcome.
32+
33+
## Currently Supported Features
34+
35+
- Reading and Writing to InfluxDB
36+
- Optional Serde Support for Deserialization
37+
38+
## Planned Features
39+
40+
- Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`)
41+
- Read Query Builder instead of supplying raw queries
42+
- Authentication against InfluxDB
43+
- Methods for setting time and time precision in a query
44+
45+
## Quickstart
46+
47+
Add the following to your `Cargo.toml`
48+
49+
```toml
50+
influxdb = "0.0.1"
51+
```
52+
53+
For an example with using Serde deserialization, please refer to [serde_integration](crate::integrations::serde_integration)
54+
55+
```rust
56+
use influxdb::query::InfluxDbQuery;
57+
use influxdb::client::InfluxDbClient;
58+
use serde::Deserialize;
59+
use tokio::runtime::current_thread::Runtime;
60+
61+
// Create a InfluxDbClient with URL `http://localhost:8086`
62+
// and database name `test`
63+
let client = InfluxDbClient::new("http://localhost:8086", "test");
64+
65+
// Let's write something to InfluxDB. First we're creating a
66+
// InfluxDbWriteQuery to write some data.
67+
// This creates a query which writes a new measurement into a series called `weather`
68+
let write_query = InfluxDbQuery::write_query("weather")
69+
.add_field("temperature", 82);
70+
71+
// Since this library is async by default, we're going to need a Runtime,
72+
// which can asynchonously run our query.
73+
// The [tokio](https://crates.io/crates/tokio) crate lets us easily create a new Runtime.
74+
let mut rt = Runtime::new().expect("Unable to create a runtime");
75+
76+
// To actually submit the data to InfluxDB, the `block_on` method can be used to
77+
// halt execution of our program until it has been completed.
78+
let write_result = rt.block_on(client.query(write_query));
79+
assert!(write_result.is_ok(), "Write result was not okay");
80+
81+
// Reading data is as simple as writing. First we need to create a query
82+
let read_query = InfluxDbQuery::raw_read_query("SELECT _ FROM weather");
83+
84+
// Again, we're blocking until the request is done
85+
let read_result = rt.block_on(client.query(read_query));
86+
87+
assert!(read_result.is_ok(), "Read result was not ok");
88+
89+
// We can be sure the result was successful, so we can unwrap the result to get
90+
// the response String from InfluxDB
91+
println!("{}", read_result.unwrap());
92+
```
93+
94+
For further examples, check out the Integration Tests in `tests/integration_tests.rs`
95+
in the repository.
96+
97+
## License
98+
99+
The MIT License @ Gero Gerke 2019

src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@
1313
//!
1414
//! # Planned Features
1515
//!
16-
//! * Better support queries like `CREATE`, `DROP` or `ALTER` which need to be sent as `POST` requests
1716
//! * Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`)
1817
//! * Read Query Builder instead of supplying raw queries
1918
//! * Authentication against InfluxDB
2019
//! * Methods for setting time and time precision in a query
2120
//!
2221
//! # Quickstart
2322
//!
24-
//! For a example with using Serde deserialization, please refer to [serde_integration](crate::integrations::serde_integration)
23+
//! Add the following to your `Cargo.toml`
24+
//!
25+
//! ```toml
26+
//! influxdb = "0.0.1"
27+
//! ```
28+
//!
29+
//! For an example with using Serde deserialization, please refer to [serde_integration](crate::integrations::serde_integration)
2530
//!
2631
//! ```rust,no_run
2732
//! use influxdb::query::InfluxDbQuery;

0 commit comments

Comments
 (0)