This commit is contained in:
2025-10-09 22:16:29 +02:00
commit 768f8cb21c
33 changed files with 12047 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
use std::time::Duration;
use diesel::pg::PgConnection;
use diesel::r2d2::{ConnectionManager, Pool};
pub type PgPool = Pool<ConnectionManager<PgConnection>>;
pub fn init_pool(database_url: &str) -> anyhow::Result<PgPool> {
let manager = ConnectionManager::<PgConnection>::new(database_url);
let pool = Pool::builder()
.max_size(16)
.connection_timeout(Duration::from_secs(10))
.build(manager)?;
Ok(pool)
}