Expand description
Production-grade async connection pool.
Generic over any connection type that implements Poolable.
Features: waiter queue with dead-waiter skipping, jittered max-life,
health checks on checkout, lifecycle hooks, graceful drain, and metrics.
§Example with pg-wired (requires wire feature)
use pg_pool::{ConnPool, ConnPoolConfig, LifecycleHooks};
use pg_pool::wire::WirePoolable;
let mut config = ConnPoolConfig::default();
config.addr = "127.0.0.1:5432".into();
config.user = "postgres".into();
config.password = "postgres".into();
config.database = "mydb".into();
let _pool = ConnPool::<WirePoolable>::new(config, LifecycleHooks::default()).await?;Modules§
- async_
wire - pg-wired AsyncConn integration: implements
Poolablefor async connections. - wire
- pg-wired integration: implements
Poolableforpg_wired::WireConn.
Structs§
- Conn
Pool - Production-grade connection pool, generic over connection type
C. - Conn
Pool Config - Connection pool configuration.
- Lifecycle
Hooks - Lifecycle hook callbacks. All hooks are optional.
- Pool
Guard - A checked-out connection that returns itself to the pool on drop.
- Pool
Metrics - Snapshot of pool metrics.
Enums§
- Pool
Error - Errors returned by pool operations.
Traits§
- Poolable
- Trait for connection types that can be managed by the pool.