Skip to main content

dr_metrix_postgres/pool/
mod.rs

1use async_trait::async_trait;
2use dr_metrix_core::error::Result;
3
4pub struct PoolStatus {
5    pub max_size: u32,
6    pub available: u32,
7    pub in_use: u32,
8}
9
10#[async_trait]
11pub trait PoolAdapter: Send + Sync + 'static {
12    async fn query_json(
13        &self,
14        sql: &str,
15    ) -> Result<Vec<serde_json::Map<String, serde_json::Value>>>;
16    fn pool_status(&self) -> PoolStatus;
17}
18
19#[cfg(feature = "diesel-async")]
20pub mod deadpool;
21
22#[cfg(feature = "r2d2")]
23pub mod r2d2;
24
25#[cfg(feature = "sea-orm")]
26pub mod seaorm;