anvilforge-cast-core 0.1.0

Cast ORM core for Anvilforge: Model trait, QueryBuilder, Column, Relation, Schema, migrations.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Database connection pool. Postgres-only for v1 POC.

use sqlx::postgres::PgPoolOptions;

pub type Pool = sqlx::PgPool;

pub async fn connect(url: &str, max_connections: u32) -> Result<Pool, crate::Error> {
    let pool = PgPoolOptions::new()
        .max_connections(max_connections)
        .connect(url)
        .await?;
    Ok(pool)
}