mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
The documentation for `PgAdvisoryLockGuard` lists a set of types that should be able to be passed to it, but when actually trying to do so, compilation would fail due to missing `AsMut` trait implementations for those types. This commit adds the missing `AsMut` impls so that `Transaction` and `PgConnection` can be used as type parameters to `PgAdvisoryLockGuard`, as expected. For reference: https://github.com/launchbadge/sqlx/issues/2520
This commit is contained in:
committed by
GitHub
parent
e2ce463af8
commit
1bdbedabdc
@@ -197,6 +197,16 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
// Implement `AsMut<DB::Connection>` so `Transaction` can be given to a
|
||||
// `PgAdvisoryLockGuard`.
|
||||
//
|
||||
// See: https://github.com/launchbadge/sqlx/issues/2520
|
||||
impl<'c, DB: Database> AsMut<DB::Connection> for Transaction<'c, DB> {
|
||||
fn as_mut(&mut self) -> &mut DB::Connection {
|
||||
&mut self.connection
|
||||
}
|
||||
}
|
||||
|
||||
impl<'c, 't, DB: Database> crate::acquire::Acquire<'t> for &'t mut Transaction<'c, DB> {
|
||||
type Database = DB;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user