@@ -12,6 +12,9 @@ mod private {
1212/// This trait is "sealed", and cannot be implemented outside of this crate.
1313#[ async_trait]
1414pub trait GenericClient : private:: Sealed {
15+ /// Get a reference to the underlying `Client`
16+ fn client ( & self ) -> & Client ;
17+
1518 /// Like `Client::execute`.
1619 async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
1720 where
@@ -74,6 +77,10 @@ impl private::Sealed for Client {}
7477
7578#[ async_trait]
7679impl GenericClient for Client {
80+ fn client ( & self ) -> & Client {
81+ self
82+ }
83+
7784 async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
7885 where
7986 T : ?Sized + ToStatement + Sync + Send ,
@@ -152,6 +159,10 @@ impl private::Sealed for Transaction<'_> {}
152159#[ async_trait]
153160#[ allow( clippy:: needless_lifetimes) ]
154161impl GenericClient for Transaction < ' _ > {
162+ fn client ( & self ) -> & Client {
163+ self . client ( )
164+ }
165+
155166 async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
156167 where
157168 T : ?Sized + ToStatement + Sync + Send ,
0 commit comments