Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use owned row cache in sync wrapper #147

Merged
merged 4 commits into from
May 6, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ jobs:
- name: Check formating
run: cargo +stable fmt --all -- --check
minimal_rust_version:
name: Check Minimal supported rust version (1.65.0)
name: Check Minimal supported rust version (1.78.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.65.0
- uses: dtolnay/rust-toolchain@1.78.0
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions
Expand All @@ -240,4 +240,4 @@ jobs:
# has broken min-version dependencies
# cannot test sqlite yet as that crate
# as broken min-version dependencies as well
run: cargo +stable minimal-versions check -p diesel-async --features "postgres bb8 deadpool mobc"
run: cargo +1.78.0 minimal-versions check -p diesel-async --features "postgres bb8 deadpool mobc"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/

* Added type `diesel_async::pooled_connection::mobc::PooledConnection`
* MySQL/MariaDB now use `CLIENT_FOUND_ROWS` capability to allow consistent behavior with PostgreSQL regarding return value of UPDATe commands.
* The minimal supported rust version is now 1.78.0

## [0.4.1] - 2023-09-01

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/weiznich/diesel_async"
keywords = ["orm", "database", "sql", "async"]
categories = ["database"]
description = "An async extension for Diesel the safe, extensible ORM and Query Builder"
rust-version = "1.65.0"
rust-version = "1.78.0"

[dependencies]
diesel = { version = "~2.1.1", default-features = false, features = ["i-implement-a-third-party-backend-and-opt-into-breaking-changes"]}
Expand Down Expand Up @@ -63,4 +63,4 @@ members = [
]

[patch.crates-io]
diesel = { git = "http://github.com/diesel-rs/diesel", rev = "793de72" }
diesel = { git = "http://github.com/diesel-rs/diesel", "rev" = "f2eb9b2"}
5 changes: 4 additions & 1 deletion src/sync_connection_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ where
{
self.execute_with_prepared_query(source.as_query(), |conn, query| {
use diesel::row::IntoOwnedRow;
let mut cache = <<<C as LoadConnection>::Row<'_, '_> as IntoOwnedRow<
<C as Connection>::Backend,
>>::Cache as Default>::default();
conn.load(&query).map(|c| {
c.map(|row| row.map(IntoOwnedRow::into_owned))
c.map(|row| row.map(|r| IntoOwnedRow::into_owned(r, &mut cache)))
.collect::<Vec<QueryResult<O>>>()
})
})
Expand Down