@@ -12,6 +12,9 @@ mod private {
12
12
/// This trait is "sealed", and cannot be implemented outside of this crate.
13
13
#[ async_trait]
14
14
pub trait GenericClient : private:: Sealed {
15
+ /// Get a reference to the underlying `Client`
16
+ fn client ( & self ) -> & Client ;
17
+
15
18
/// Like `Client::execute`.
16
19
async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
17
20
where
@@ -74,6 +77,10 @@ impl private::Sealed for Client {}
74
77
75
78
#[ async_trait]
76
79
impl GenericClient for Client {
80
+ fn client ( & self ) -> & Client {
81
+ self
82
+ }
83
+
77
84
async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
78
85
where
79
86
T : ?Sized + ToStatement + Sync + Send ,
@@ -152,6 +159,10 @@ impl private::Sealed for Transaction<'_> {}
152
159
#[ async_trait]
153
160
#[ allow( clippy:: needless_lifetimes) ]
154
161
impl GenericClient for Transaction < ' _ > {
162
+ fn client ( & self ) -> & Client {
163
+ self . client ( )
164
+ }
165
+
155
166
async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
156
167
where
157
168
T : ?Sized + ToStatement + Sync + Send ,
0 commit comments