Skip to content

Commit 9eb5dc5

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/parametrized-version
2 parents ff46a3e + 9023443 commit 9eb5dc5

File tree

17 files changed

+279
-267
lines changed

17 files changed

+279
-267
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
### Checklist
66
- [ ] Formatted code using `cargo fmt --all`
7-
- [ ] Linted code using clippy
8-
- [ ] with reqwest feature: `cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,reqwest-client-rustls -- -D warnings`
9-
- [ ] with surf feature: `cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,hyper-client -- -D warnings`
7+
- [ ] Linted code using clippy with reqwest feature: `cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features chrono,time,serde,derive,reqwest-client-rustls -- -D warnings`
108
- [ ] Updated README.md using `cargo doc2readme -p influxdb --expand-macros`
119
- [ ] Reviewed the diff. Did you leave any print statements or unnecessary comments?
1210
- [ ] Any unfinished work that warrants a separate issue captured in an issue with a TODO code comment

.github/workflows/rust.yml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: README Format Check
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- uses: docker://codeberg.org/msrd0/cargo-doc2readme:nightly
1717
with:
1818
entrypoint: cargo
@@ -23,23 +23,21 @@ jobs:
2323
name: Style Check (clippy)
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v5
2727
- uses: dtolnay/[email protected]
2828
with:
2929
components: clippy
3030
- name: Update Cargo.lock
3131
run: cargo --config 'resolver.incompatible-rust-versions="fallback"' update
3232
- name: Check Clippy lints (reqwest)
33-
run: cargo clippy --manifest-path influxdb/Cargo.toml --locked --all-targets --no-default-features --features serde,derive,reqwest-client-rustls -- -D warnings
34-
- name: Check Clippy lints (surf)
35-
run: cargo clippy --manifest-path influxdb/Cargo.toml --locked --all-targets --no-default-features --features serde,derive,hyper-client -- -D warnings
33+
run: cargo clippy --manifest-path influxdb/Cargo.toml --locked --all-targets --no-default-features --features chrono,time,serde,derive,reqwest-client-rustls -- -D warnings
3634

3735
# this checks that the code is formatted with rustfmt
3836
rustfmt:
3937
name: Style Checks (rustfmt)
4038
runs-on: ubuntu-latest
4139
steps:
42-
- uses: actions/checkout@v4
40+
- uses: actions/checkout@v5
4341
- uses: dtolnay/rust-toolchain@nightly
4442
with:
4543
components: rustfmt
@@ -72,7 +70,7 @@ jobs:
7270
nightly: false
7371
os: ubuntu-latest
7472
steps:
75-
- uses: actions/checkout@v4
73+
- uses: actions/checkout@v5
7674
- uses: dtolnay/rust-toolchain@master
7775
with:
7876
toolchain: ${{matrix.rust.toolchain}}
@@ -108,8 +106,8 @@ jobs:
108106
key: "${{runner.os}} Rust ${{steps.msrv-toolchain.outputs.cachekey}}"
109107
if: matrix.rust.name == 'MSRV'
110108
# finally we can run tests
111-
- run: cargo test --lib --locked
112-
- run: cargo test --doc --locked
109+
- run: cargo test --lib --locked --features 'chrono time serde derive'
110+
- run: cargo test --doc --locked --features 'chrono time serde derive'
113111

114112
# this tests that all integration tests are successful
115113
integration_tests:
@@ -124,10 +122,6 @@ jobs:
124122
toolchain: stable
125123
nightly: false
126124
http-backend:
127-
- curl-client
128-
- h1-client
129-
- h1-client-rustls
130-
- hyper-client
131125
- reqwest-client-rustls
132126
- reqwest-client-native-tls
133127
- reqwest-client-native-tls-vendored
@@ -158,7 +152,7 @@ jobs:
158152
DOCKER_INFLUXDB_INIT_BUCKET: mydb
159153
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: admintoken
160154
steps:
161-
- uses: actions/checkout@v4
155+
- uses: actions/checkout@v5
162156
- uses: dtolnay/rust-toolchain@master
163157
with:
164158
toolchain: ${{matrix.rust.toolchain}}
@@ -172,10 +166,12 @@ jobs:
172166
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}"
173167
- name: Run tests
174168
run: |
175-
for test in integration_tests{,_v2}
176-
do
177-
cargo test -p influxdb --no-default-features --features 'serde derive ${{matrix.http-backend}}' --no-fail-fast --test $test
178-
done
169+
cargo test -p influxdb \
170+
--no-default-features \
171+
--features "serde derive chrono time ${{matrix.http-backend}}" \
172+
--no-fail-fast \
173+
--test integration_tests \
174+
--test integration_tests_v2
179175
180176
# this uses cargo-tarpaulin to inspect the code coverage
181177
coverage:
@@ -198,7 +194,7 @@ jobs:
198194
INFLUXDB_USER_PASSWORD: password
199195

200196
steps:
201-
- uses: actions/checkout@v4
197+
- uses: actions/checkout@v5
202198
- uses: dtolnay/rust-toolchain@stable
203199
id: rust-toolchain
204200
- name: Get Tarpaulin Version
@@ -221,7 +217,7 @@ jobs:
221217
cargo tarpaulin -v \
222218
--target-dir target/tarpaulin \
223219
--workspace \
224-
--features serde,derive \
220+
--features chrono,time,serde,derive \
225221
--exclude-files 'derive/*' \
226222
--exclude-files 'target/*' \
227223
--ignore-panics --ignore-tests \
@@ -243,10 +239,10 @@ jobs:
243239
- coverage
244240
if: github.ref == 'refs/heads/main'
245241
steps:
246-
- uses: actions/checkout@v4
242+
- uses: actions/checkout@v5
247243
with:
248244
ref: gh-pages
249-
- uses: actions/download-artifact@v4
245+
- uses: actions/download-artifact@v5
250246
with:
251247
name: tarpaulin-report
252248
- run: |
@@ -256,6 +252,6 @@ jobs:
256252
257253
git add coverage.svg tarpaulin-report.html
258254
git status
259-
- uses: stefanzweifel/git-auto-commit-action@v5
255+
- uses: stefanzweifel/git-auto-commit-action@v6
260256
with:
261257
commit_message: "GitHub Pages for ${{ github.sha }}"

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Removed
11+
- `<dyn Query>::raw_read_query`, deprecated in 0.5.0, was removed
12+
1013
## [0.7.2] - 2024-02-14
1114

1215
### Fixed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ resolver = "2"
66

77
[workspace.package]
88
authors = ["Gero Gerke <[email protected]>", "Dominic <[email protected]>"]
9-
edition = "2018"
10-
rust-version = "1.65"
9+
edition = "2021"
10+
rust-version = "1.67.1"
1111
license = "MIT"
1212
repository = "https://github.com/influxdb-rs/influxdb-rust"
1313

README.md

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<a href="https://www.rust-lang.org/en-US/">
2626
<img src="https://img.shields.io/badge/Made%20with-Rust-orange.svg" alt='Build with Rust' />
2727
</a>
28-
<a href="https://github.com/rust-lang/rust/releases/tag/1.65.0">
29-
<img src="https://img.shields.io/badge/rustc-1.65.0+-yellow.svg" alt='Minimum Rust Version: 1.65.0' />
28+
<a href="https://github.com/rust-lang/rust/releases/tag/1.67.1">
29+
<img src="https://img.shields.io/badge/rustc-1.67.1+-yellow.svg" alt='Minimum Rust Version: 1.67.1' />
3030
</a>
3131
</p>
3232

@@ -60,7 +60,6 @@ use chrono::{DateTime, Utc};
6060
use influxdb::{Client, Error, InfluxDbWriteable, ReadQuery, Timestamp};
6161

6262
#[tokio::main]
63-
// or #[async_std::main] if you prefer
6463
async fn main() -> Result<(), Error> {
6564
// Connect to db `test` on `http://localhost:8086`
6665
let client = Client::new("http://localhost:8086", "test");
@@ -122,55 +121,23 @@ To communicate with InfluxDB, you can choose the HTTP backend to be used configu
122121
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls-vendored"] }
123122
```
124123

125-
* **[hyper][__link9]** (through surf), use this if you need tokio 0.2 compatibility
126-
```toml
127-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "hyper-client"] }
128-
```
129-
130-
* **[curl][__link10]**, using [libcurl][__link11]
131-
```toml
132-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "curl-client"] }
133-
```
134-
135-
* **[async-h1][__link12]** with native TLS (OpenSSL)
136-
```toml
137-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client"] }
138-
```
139-
140-
* **[async-h1][__link13]** with [rustls][__link14]
141-
```toml
142-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client-rustls"] }
143-
```
144-
145-
* WebAssembly’s `window.fetch`, via `web-sys` and **[wasm-bindgen][__link15]**
146-
```toml
147-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "wasm-client"] }
148-
```
149-
150124
## License
151125

152-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)][__link16]
126+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)][__link9]
153127

154128

155129
@ 2020-2024 Gero Gerke, msrd0 and [contributors].
156130

157131
[contributors]: https://github.com/influxdb-rs/influxdb-rust/graphs/contributors
158-
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEGzJ_QpW55zB1G0S-TER-rIfLG2gXv8EYBG3jG1nuXXn-kdx-YXKEG1LaAVLASZMqG5J2qfpyCvbMG_Rohh5BobOmG0DqLv5454SZYWSBgmhpbmZsdXhkYmUwLjcuMg
132+
[__cargo_doc2readme_dependencies_info]: ggGkYW0CYXSEGzJ_QpW55zB1G0S-TER-rIfLG2gXv8EYBG3jG1nuXXn-kdx-YXKEG8LHWNBBuXgSGz-2Lrx4E_kTG0bJiXb6A8zNG9GhXhvU8L0xYWSBgmhpbmZsdXhkYmUwLjcuMg
159133
[__link0]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CONTRIBUTING.md
160134
[__link1]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CODE_OF_CONDUCT.md
161-
[__link10]: https://github.com/alexcrichton/curl-rust
162-
[__link11]: https://curl.se/libcurl/
163-
[__link12]: https://github.com/http-rs/async-h1
164-
[__link13]: https://github.com/http-rs/async-h1
165-
[__link14]: https://github.com/ctz/rustls
166-
[__link15]: https://github.com/rustwasm/wasm-bindgen
167-
[__link16]: https://opensource.org/licenses/MIT
168135
[__link2]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CHANGELOG.md
169136
[__link3]: https://github.com/influxdb-rs/influxdb-rust/blob/main/influxdb/Cargo.toml
170137
[__link4]: https://docs.rs/influxdb/0.7.2/influxdb/?search=integrations::serde_integration
171138
[__link5]: https://github.com/hyperium/hyper
172139
[__link6]: https://github.com/ctz/rustls
173140
[__link7]: https://github.com/hyperium/hyper
174141
[__link8]: https://github.com/hyperium/hyper
175-
[__link9]: https://github.com/hyperium/hyper
142+
[__link9]: https://opensource.org/licenses/MIT
176143

benches/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2018"
1010
chrono = { version = "0.4.11", features = ["serde"] }
1111
futures = "0.3.4"
1212
influxdb = { path = "../influxdb", features = ["derive"] }
13-
tokio = { version = "0.2.22", features = ["macros", "rt-threaded", "sync"] }
13+
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread", "sync"] }
1414

1515
[[bench]]
1616
name = "client"

influxdb/Cargo.toml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,39 @@ repository.workspace = true
1616
[lints]
1717
workspace = true
1818

19+
[[test]]
20+
name = "derive_integration_tests"
21+
path = "tests/derive_integration_tests.rs"
22+
required-features = ["chrono"]
23+
1924
[dependencies]
20-
chrono = { version = "0.4.23", features = ["serde"], default-features = false }
25+
chrono = { version = "0.4.23", features = ["serde"], default-features = false, optional = true }
2126
futures-util = "0.3.17"
22-
http = "0.2.4"
27+
http = "1.3.1"
2328
influxdb_derive = { version = "0.5.1", optional = true }
2429
lazy-regex = "3.1"
25-
reqwest = { version = "0.11.4", default-features = false, optional = true }
26-
surf = { version = "2.2.0", default-features = false, optional = true }
30+
reqwest = { version = "0.12.23", default-features = false }
2731
serde = { version = "1.0.186", optional = true }
2832
serde_derive = { version = "1.0.186", optional = true }
2933
serde_json = { version = "1.0.48", optional = true }
30-
thiserror = "1.0"
34+
surf = { version = "2.2.0", default-features = false, optional = true }
35+
thiserror = "2.0.16"
36+
time = { version = "0.3.39", optional = true }
3137

3238
[features]
3339
default = ["serde", "reqwest-client-rustls"]
3440
derive = ["dep:influxdb_derive"]
3541
serde = ["dep:serde", "dep:serde_derive", "dep:serde_json"]
3642

3743
# http clients
38-
curl-client = ["surf", "surf/curl-client"]
39-
h1-client = ["surf", "surf/h1-client"]
40-
h1-client-rustls = ["surf", "surf/h1-client-rustls"]
41-
hyper-client = ["surf", "surf/hyper-client"]
42-
reqwest-client-rustls = ["reqwest", "reqwest/rustls-tls-webpki-roots"]
43-
reqwest-client-native-tls = ["reqwest", "reqwest/native-tls-alpn"]
44-
reqwest-client-native-tls-vendored = ["reqwest", "reqwest/native-tls-vendored"]
45-
wasm-client = ["surf", "surf/wasm-client"]
44+
reqwest-client-rustls = ["reqwest/rustls-tls-webpki-roots"]
45+
reqwest-client-native-tls = ["reqwest/native-tls-alpn"]
46+
reqwest-client-native-tls-vendored = ["reqwest/native-tls-vendored"]
47+
48+
# etc
49+
time = ["dep:time"]
50+
chrono = ["dep:chrono"]
4651

4752
[dev-dependencies]
48-
async-std = { version = "1.6.5", features = ["attributes", "tokio02", "tokio1"] }
49-
indoc = "1.0"
53+
indoc = "2.0.6"
5054
tokio = { version = "1.7", features = ["macros", "rt-multi-thread"] }

influxdb/src/client/mod.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616
//! ```
1717
1818
use futures_util::TryFutureExt;
19-
#[cfg(feature = "reqwest")]
2019
use reqwest::{Client as HttpClient, RequestBuilder, Response as HttpResponse};
2120
use std::collections::{BTreeMap, HashMap};
2221
use std::fmt::{self, Debug, Formatter};
23-
use std::sync::Arc;
24-
#[cfg(feature = "surf")]
25-
use surf::{Client as HttpClient, RequestBuilder, Response as HttpResponse};
2622
use std::marker::PhantomData;
23+
use std::sync::Arc;
2724

2825
use crate::query::QueryType;
2926
use crate::Error;
@@ -181,7 +178,6 @@ impl<V> Client<V, reqwest::Client> {
181178
const BUILD_HEADER: &str = "X-Influxdb-Build";
182179
const VERSION_HEADER: &str = "X-Influxdb-Version";
183180

184-
#[cfg(feature = "reqwest")]
185181
let (build, version) = {
186182
let hdrs = res.headers();
187183
(
@@ -191,11 +187,6 @@ impl<V> Client<V, reqwest::Client> {
191187
)
192188
};
193189

194-
#[cfg(feature = "surf")]
195-
let build = res.header(BUILD_HEADER).map(|value| value.as_str());
196-
#[cfg(feature = "surf")]
197-
let version = res.header(VERSION_HEADER).map(|value| value.as_str());
198-
199190
Ok((build.unwrap().to_owned(), version.unwrap().to_owned()))
200191
}
201192

@@ -214,7 +205,7 @@ impl<V> Client<V, reqwest::Client> {
214205
/// use influxdb::InfluxDbWriteable;
215206
/// use std::time::{SystemTime, UNIX_EPOCH};
216207
///
217-
/// # #[async_std::main]
208+
/// # #[tokio::main]
218209
/// # async fn main() -> Result<(), influxdb::Error> {
219210
/// let start = SystemTime::now();
220211
/// let since_the_epoch = start
@@ -267,11 +258,6 @@ impl<V> Client<V, reqwest::Client> {
267258
}
268259
};
269260

270-
#[cfg(feature = "surf")]
271-
let request_builder = request_builder.map_err(|err| Error::UrlConstructionError {
272-
error: err.to_string(),
273-
})?;
274-
275261
let res = self
276262
.auth_if_needed(request_builder)
277263
.send()
@@ -281,12 +267,7 @@ impl<V> Client<V, reqwest::Client> {
281267
.await?;
282268
check_status(&res)?;
283269

284-
#[cfg(feature = "reqwest")]
285270
let body = res.text();
286-
#[cfg(feature = "surf")]
287-
let mut res = res;
288-
#[cfg(feature = "surf")]
289-
let body = res.body_string();
290271

291272
let s = body.await.map_err(|_| Error::DeserializationError {
292273
error: "response could not be converted to UTF-8".into(),
@@ -329,7 +310,8 @@ mod tests {
329310

330311
#[test]
331312
fn test_client_debug_redacted_password() {
332-
let client: Client<InfluxVersion1> = Client::new("https://localhost:8086", "db").with_auth("user", "pass");
313+
let client: Client<InfluxVersion1> =
314+
Client::new("https://localhost:8086", "db").with_auth("user", "pass");
333315
let actual = format!("{client:#?}");
334316
let expected = indoc! { r#"
335317
Client {

0 commit comments

Comments
 (0)