sqlx-pool-registry 0.2.1

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

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