Skip to content

Commit 4c44953

Browse files
authored
Merge pull request #264 from weiznich/prepare/0.7.0
Prepare a 0.7.0 release
2 parents 3569190 + d0c4ea0 commit 4c44953

File tree

8 files changed

+74
-5
lines changed

8 files changed

+74
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/
66

77
## [Unreleased]
88

9+
## [0.7.0]
10+
11+
* Support for diesel 2.3
912
* Added support for running migrations via `AsyncMigrationHarness`
13+
* Improved ergonomics of using query pipelining with `AsyncPgConnection`
14+
* Added the ability to cancel queries using `AsyncMysqlConnection::cancel_token`
1015

1116
## [0.6.1] - 2025-07-03
1217

@@ -103,4 +108,5 @@ in the pool should be checked if they are still valid
103108
[0.5.2]: https://github.com/weiznich/diesel_async/compare/v0.5.1...v0.5.2
104109
[0.6.0]: https://github.com/weiznich/diesel_async/compare/v0.5.2...v0.6.0
105110
[0.6.1]: https://github.com/weiznich/diesel_async/compare/v0.6.0...v0.6.1
106-
[Unreleased]: https://github.com/weiznich/diesel_async/compare/v0.6.1...main
111+
[0.7.0]: https://github.com/weiznich/diesel_async/compare/v0.6.0...v0.7.0
112+
[Unreleased]: https://github.com/weiznich/diesel_async/compare/v0.7.0...main

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "diesel-async"
3-
version = "0.6.1"
3+
version = "0.7.0"
44
authors = ["Georg Semmler <[email protected]>"]
55
edition = "2021"
66
autotests = false
@@ -110,6 +110,7 @@ rustdoc-args = ["--cfg", "docsrs", "-Z", "unstable-options", "--generate-link-to
110110
[workspace]
111111
members = [
112112
".",
113+
"examples/postgres/pipelining",
113114
"examples/postgres/pooled-with-rustls",
114115
"examples/postgres/run-pending-migrations-with-rustls",
115116
"examples/sync-wrapper",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "pipelining"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
diesel-async = { version = "0.7.0", path = "../../../", features = ["bb8", "postgres"] }
8+
tokio = { version = "1.2.0", default-features = false, features = ["macros", "rt-multi-thread"] }
9+
10+
[dependencies.diesel]
11+
version = "2.3.0"
12+
default-features = false
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
use diesel::prelude::*;
2+
use diesel_async::{AsyncConnection, AsyncPgConnection, RunQueryDsl};
3+
4+
diesel::table! {
5+
users {
6+
id -> Integer,
7+
name -> Text,
8+
}
9+
}
10+
11+
#[derive(HasQuery, Debug)]
12+
struct User {
13+
id: i32,
14+
name: String,
15+
}
16+
17+
impl User {
18+
async fn load_all(mut conn: &AsyncPgConnection) -> QueryResult<Vec<Self>> {
19+
Self::query().load(&mut conn).await
20+
}
21+
22+
async fn filter_by_id(mut conn: &AsyncPgConnection, id: i32) -> QueryResult<Option<Self>> {
23+
Self::query()
24+
.find(id)
25+
.get_result(&mut conn)
26+
.await
27+
.optional()
28+
}
29+
}
30+
31+
#[tokio::main]
32+
async fn main() -> Result<(), Box<dyn std::error::Error>> {
33+
let db_url = std::env::var("DATABASE_URL").expect("Env var `DATABASE_URL` not set");
34+
let mut conn = AsyncPgConnection::establish(&db_url).await?;
35+
36+
let all_users = User::query().load(&mut conn);
37+
let single_user = User::query().find(1).get_result(&mut conn);
38+
39+
let (all_users, single_user) = tokio::try_join!(all_users, single_user)?;
40+
println!("All users: {all_users:?}");
41+
println!("Single user: {single_user:?}");
42+
43+
let (all_users, single_user) =
44+
tokio::try_join!(User::load_all(&conn), User::filter_by_id(&conn, 1))?;
45+
46+
println!("All users: {all_users:?}");
47+
println!("Single user: {single_user:?}");
48+
49+
Ok(())
50+
}
3.5 MB
Binary file not shown.

examples/postgres/pooled-with-rustls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
diesel-async = { version = "0.6.0", path = "../../../", features = ["bb8", "postgres"] }
9+
diesel-async = { version = "0.7.0", path = "../../../", features = ["bb8", "postgres"] }
1010
futures-util = "0.3.21"
1111
rustls = "0.23.8"
1212
rustls-platform-verifier = "0.5.0"

examples/postgres/run-pending-migrations-with-rustls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
diesel-async = { version = "0.6.0", path = "../../../", features = ["bb8", "postgres", "migrations"] }
9+
diesel-async = { version = "0.7.0", path = "../../../", features = ["bb8", "postgres", "migrations"] }
1010
futures-util = "0.3.21"
1111
rustls = "0.23.8"
1212
rustls-platform-verifier = "0.5.0"

examples/sync-wrapper/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
diesel-async = { version = "0.6.0", path = "../../", features = ["sync-connection-wrapper", "async-connection-wrapper"] }
9+
diesel-async = { version = "0.7.0", path = "../../", features = ["sync-connection-wrapper", "async-connection-wrapper"] }
1010
futures-util = "0.3.21"
1111
tokio = { version = "1.2.0", default-features = false, features = ["macros", "rt-multi-thread"] }
1212

0 commit comments

Comments
 (0)