Model SqlPool
sql::SqlPool
Parameters
↳ const acquire_timeout: u64 = 10000
↳ const idle_timeout: Option<u64> = 600000
↳ const max_connections: u32 = 10
↳ const max_lifetime: Option<u64> = 1800000
↳ const min_connections: u32 = 0
↳ const url: string
Sources
⤇ closed: sql::closed
⤇ connected: sql::connected
⤇ failure: sql::failure
SQL connection pool.
Manages a pool of database connections for a single database URL. Supports PostgreSQL, MySQL, MariaDB, and SQLite via a unified driver.
url: database connection URL (e.g."postgresql://user@host/db").max_connections: maximum number of simultaneous connections (default10).min_connections: minimum number of idle connections to keep open (default0).acquire_timeout: milliseconds to wait before failing to acquire a connection (default10000).idle_timeout: milliseconds before an idle connection is closed;nonedisables the timeout (default600000).max_lifetime: milliseconds before a connection is recycled;nonedisables recycling (default1800000).
Use connect to open the pool and close to drain it explicitly.
The connected source fires a track once the pool is ready;
failure fires a track when the connection attempt fails;
closed fires a track when the pool is drained.