pub mod conn_box;
pub mod conn_manager;
use crate::db::Connection;
use crate::pool::conn_manager::ConnManager;
use crate::Error;
use async_trait::async_trait;
use rbs::Value;
use std::fmt::Debug;
use std::time::Duration;
#[async_trait]
pub trait Pool: Sync + Send + Debug {
fn new(manager: ConnManager) -> Result<Self, Error>
where
Self: Sized;
async fn get(&self) -> Result<Box<dyn Connection>, Error>;
async fn get_timeout(&self, d: Duration) -> Result<Box<dyn Connection>, Error>;
async fn set_conn_max_lifetime(&self, max_lifetime: Option<Duration>);
async fn set_max_idle_conns(&self, n: u64);
async fn set_max_open_conns(&self, n: u64);
async fn state(&self) -> Value {
Value::Null
}
fn driver_type(&self) -> &str;
}