conn add ping method
@@ -573,6 +573,23 @@ impl DBPoolConn {
}
}
}
+
+ pub async fn ping(&mut self) -> crate::Result<()> {
+ match &self.driver_type {
+ &DriverType::None => {
+ return Err(Error::from("un init DBPool!"));
+ }
+ &DriverType::Mysql => {
+ return Ok(self.mysql.as_mut().unwrap().ping().await?);
+ }
+ &DriverType::Postgres => {
+ return Ok(self.postgres.as_mut().unwrap().ping().await?);
+ }
+ &DriverType::Sqlite => {
+ return Ok(self.sqlite.as_mut().unwrap().ping().await?);
+ }
+ }
+ }
}
