basiliq 0.1.2

REST API server exposing a Postgres database using JSON:API
1
2
3
4
5
6
7
8
9
10
11
12
13
use super::*;
use sqlx::ConnectOptions;
use tracing::info;

/// Open a single connection to the database provided the connection option
pub async fn get_single_connection(
    opt: &BasiliqDbConnectionOption,
) -> Result<sqlx::PgConnection, sqlx::Error> {
    info!("Connecting to the database..."); // TODO See https://github.com/launchbadge/sqlx/issues/659
    let res = opt.connection_option().connect().await?;
    info!("Connected"); // TODO See https://github.com/launchbadge/sqlx/issues/659
    Ok(res)
}