10 lines
284 B
Rust
10 lines
284 B
Rust
use sqlx::{PgPool, postgres::PgPoolOptions};
|
|
|
|
pub async fn create_pool(database_url: &str) -> Result<PgPool, crate::error::AppError> {
|
|
PgPoolOptions::new()
|
|
.max_connections(10)
|
|
.connect(database_url)
|
|
.await
|
|
.map_err(crate::error::AppError::from)
|
|
}
|