1use crate::Poolable;
4
5pub struct WirePoolable(pub pg_wired::WireConn);
7
8impl std::ops::Deref for WirePoolable {
9 type Target = pg_wired::WireConn;
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
13}
14
15impl std::ops::DerefMut for WirePoolable {
16 fn deref_mut(&mut self) -> &mut Self::Target {
17 &mut self.0
18 }
19}
20
21impl Poolable for WirePoolable {
22 type Error = pg_wired::PgWireError;
23
24 async fn connect(
25 addr: &str,
26 user: &str,
27 password: &str,
28 database: &str,
29 ) -> Result<Self, Self::Error> {
30 let conn = pg_wired::WireConn::connect(addr, user, password, database).await?;
31 Ok(WirePoolable(conn))
32 }
33
34 fn has_pending_data(&self) -> bool {
35 self.0.has_pending_data()
36 }
37}