LCOV - code coverage report
Current view: top level - libs/proxy/tokio-postgres2/src - generic_client.rs (source / functions) Coverage Total Hit
Test: 1b0a6a0c05cee5a7de360813c8034804e105ce1c.info Lines: 0.0 % 22 0
Test Date: 2025-03-12 00:01:28 Functions: 0.0 % 12 0

            Line data    Source code
       1              : #![allow(async_fn_in_trait)]
       2              : 
       3              : use postgres_protocol2::Oid;
       4              : 
       5              : use crate::query::RowStream;
       6              : use crate::types::Type;
       7              : use crate::{Client, Error, Transaction};
       8              : 
       9              : mod private {
      10              :     pub trait Sealed {}
      11              : }
      12              : 
      13              : /// A trait allowing abstraction over connections and transactions.
      14              : ///
      15              : /// This trait is "sealed", and cannot be implemented outside of this crate.
      16              : pub trait GenericClient: private::Sealed {
      17              :     /// Like `Client::query_raw_txt`.
      18              :     async fn query_raw_txt<S, I>(&self, statement: &str, params: I) -> Result<RowStream, Error>
      19              :     where
      20              :         S: AsRef<str> + Sync + Send,
      21              :         I: IntoIterator<Item = Option<S>> + Sync + Send,
      22              :         I::IntoIter: ExactSizeIterator + Sync + Send;
      23              : 
      24              :     /// Query for type information
      25              :     async fn get_type(&self, oid: Oid) -> Result<Type, Error>;
      26              : }
      27              : 
      28              : impl private::Sealed for Client {}
      29              : 
      30              : impl GenericClient for Client {
      31            0 :     async fn query_raw_txt<S, I>(&self, statement: &str, params: I) -> Result<RowStream, Error>
      32            0 :     where
      33            0 :         S: AsRef<str> + Sync + Send,
      34            0 :         I: IntoIterator<Item = Option<S>> + Sync + Send,
      35            0 :         I::IntoIter: ExactSizeIterator + Sync + Send,
      36            0 :     {
      37            0 :         self.query_raw_txt(statement, params).await
      38            0 :     }
      39              : 
      40              :     /// Query for type information
      41            0 :     async fn get_type(&self, oid: Oid) -> Result<Type, Error> {
      42            0 :         crate::prepare::get_type(self.inner(), oid).await
      43            0 :     }
      44              : }
      45              : 
      46              : impl private::Sealed for Transaction<'_> {}
      47              : 
      48              : impl GenericClient for Transaction<'_> {
      49            0 :     async fn query_raw_txt<S, I>(&self, statement: &str, params: I) -> Result<RowStream, Error>
      50            0 :     where
      51            0 :         S: AsRef<str> + Sync + Send,
      52            0 :         I: IntoIterator<Item = Option<S>> + Sync + Send,
      53            0 :         I::IntoIter: ExactSizeIterator + Sync + Send,
      54            0 :     {
      55            0 :         self.query_raw_txt(statement, params).await
      56            0 :     }
      57              : 
      58              :     /// Query for type information
      59            0 :     async fn get_type(&self, oid: Oid) -> Result<Type, Error> {
      60            0 :         self.client().get_type(oid).await
      61            0 :     }
      62              : }
        

Generated by: LCOV version 2.1-beta