cast_core/pool.rs
1//! Database connection pool. Postgres-only for v1 POC.
2
3use sqlx::postgres::PgPoolOptions;
4
5pub type Pool = sqlx::PgPool;
6
7pub async fn connect(url: &str, max_connections: u32) -> Result<Pool, crate::Error> {
8 let pool = PgPoolOptions::new()
9 .max_connections(max_connections)
10 .connect(url)
11 .await?;
12 Ok(pool)
13}