use std::error::Error; use sqlx::{Postgres, postgres::PgConnectOptions, PgPool, Pool}; use crate::{PostgresConfig}; pub(crate) mod schemas; pub(crate) async fn connect_postgres(config: PostgresConfig) -> Result<Pool<Postgres>, Box<dyn Error>> { let connection_settings = PgConnectOptions::new() .host(&config.host) .port(config.port) .username(&config.user) .password(&config.password) .database(&config.db); let pool = PgPool::connect_with(connection_settings).await?; return Ok(pool); }