use sqlx::PgPool; use tracing::{debug, error}; use url::Url; use crate::ServiceError; pub async fn connect(url: &Url, pool_size: u32) -> Result { let host = url.host_str(); debug!(host = host, "connecting to database"); Ok(sqlx::postgres::PgPoolOptions::new() .max_connections(pool_size) .connect(url.as_str()) .await .inspect_err(|e| error!("{e}"))?) }