Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/

## [Unreleased]

## [0.7.0]

* Support for diesel 2.3
* Added support for running migrations via `AsyncMigrationHarness`
* Improved ergonomics of using query pipelining with `AsyncPgConnection`
* Added the ability to cancel queries using `AsyncMysqlConnection::cancel_token`

## [0.6.1] - 2025-07-03

Expand Down Expand Up @@ -103,4 +108,5 @@ in the pool should be checked if they are still valid
[0.5.2]: https://github.com/weiznich/diesel_async/compare/v0.5.1...v0.5.2
[0.6.0]: https://github.com/weiznich/diesel_async/compare/v0.5.2...v0.6.0
[0.6.1]: https://github.com/weiznich/diesel_async/compare/v0.6.0...v0.6.1
[Unreleased]: https://github.com/weiznich/diesel_async/compare/v0.6.1...main
[0.7.0]: https://github.com/weiznich/diesel_async/compare/v0.6.0...v0.7.0
[Unreleased]: https://github.com/weiznich/diesel_async/compare/v0.7.0...main
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "diesel-async"
version = "0.6.1"
version = "0.7.0"
authors = ["Georg Semmler <github@weiznich.de>"]
edition = "2021"
autotests = false
Expand Down Expand Up @@ -110,6 +110,7 @@ rustdoc-args = ["--cfg", "docsrs", "-Z", "unstable-options", "--generate-link-to
[workspace]
members = [
".",
"examples/postgres/pipelining",
"examples/postgres/pooled-with-rustls",
"examples/postgres/run-pending-migrations-with-rustls",
"examples/sync-wrapper",
Expand Down
12 changes: 12 additions & 0 deletions examples/postgres/pipelining/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "pipelining"
version = "0.1.0"
edition = "2024"

[dependencies]
diesel-async = { version = "0.7.0", path = "../../../", features = ["bb8", "postgres"] }
tokio = { version = "1.2.0", default-features = false, features = ["macros", "rt-multi-thread"] }

[dependencies.diesel]
version = "2.3.0"
default-features = false
50 changes: 50 additions & 0 deletions examples/postgres/pipelining/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
use diesel::prelude::*;
use diesel_async::{AsyncConnection, AsyncPgConnection, RunQueryDsl};

diesel::table! {
users {
id -> Integer,
name -> Text,
}
}

#[derive(HasQuery, Debug)]
struct User {
id: i32,
name: String,
}

impl User {
async fn load_all(mut conn: &AsyncPgConnection) -> QueryResult<Vec<Self>> {
Self::query().load(&mut conn).await
}

async fn filter_by_id(mut conn: &AsyncPgConnection, id: i32) -> QueryResult<Option<Self>> {
Self::query()
.find(id)
.get_result(&mut conn)
.await
.optional()
}
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let db_url = std::env::var("DATABASE_URL").expect("Env var `DATABASE_URL` not set");
let mut conn = AsyncPgConnection::establish(&db_url).await?;

let all_users = User::query().load(&mut conn);
let single_user = User::query().find(1).get_result(&mut conn);

let (all_users, single_user) = tokio::try_join!(all_users, single_user)?;
println!("All users: {all_users:?}");
println!("Single user: {single_user:?}");

let (all_users, single_user) =
tokio::try_join!(User::load_all(&conn), User::filter_by_id(&conn, 1))?;

println!("All users: {all_users:?}");
println!("Single user: {single_user:?}");

Ok(())
}
Binary file added examples/postgres/pipelining/src/rust_out
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/postgres/pooled-with-rustls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
diesel-async = { version = "0.6.0", path = "../../../", features = ["bb8", "postgres"] }
diesel-async = { version = "0.7.0", path = "../../../", features = ["bb8", "postgres"] }
futures-util = "0.3.21"
rustls = "0.23.8"
rustls-platform-verifier = "0.5.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
diesel-async = { version = "0.6.0", path = "../../../", features = ["bb8", "postgres", "migrations"] }
diesel-async = { version = "0.7.0", path = "../../../", features = ["bb8", "postgres", "migrations"] }
futures-util = "0.3.21"
rustls = "0.23.8"
rustls-platform-verifier = "0.5.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/sync-wrapper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

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

Expand Down
Loading