sqlx-pool-registry 0.3.0

Lightweight SQLx PostgreSQL connection pool routing for primary/replica separation
1
2
3
4
5
6
7
8
use sqlx_pool_registry::sqlx::{PgPool, postgres::PgPoolOptions};

pub fn lazy_pool(max_connections: u32) -> PgPool {
    PgPoolOptions::new()
        .max_connections(max_connections)
        .connect_lazy("postgresql://postgres:password@localhost/test")
        .unwrap()
}