pg_extras

Function pg_pool

Source
pub async fn pg_pool() -> Result<Pool<Postgres>, PgExtrasError>
Examples found in repository?
examples/db_settings.rs (line 10)
4
5
6
7
8
9
10
11
12
13
14
15
16
async fn main() -> Result<(), PgExtrasError> {
    std::env::set_var(
        "PG_EXTRAS_DATABASE_URL",
        "postgres://postgres:secret@localhost:5432/pg-extras-rs-test",
    );

    let pool = pg_pool().await?;

    let settings = db_settings(&pool).await?;
    render_table(settings);

    Ok(())
}