Skip to main content

sqlx_driver

Function sqlx_driver 

Source
pub async fn sqlx_driver(
    url: &str,
    max_connections: u32,
) -> Result<DbDriver, DataError>
Expand description

Build a SQLx-backed driver for ArclyDbPool.

let primary = sqlx_driver("postgres://app@db-primary/orders", 16).await?;
let replica = sqlx_driver("postgres://app@db-replica/orders", 16).await?;
ctx.provide(DataSourceRegistry::new(
    ArclyDbPool::new("default", primary).with_replica(replica),
));