Skip to main content

Module db

Module db 

Source
Expand description

Global connection-pool management for the compile-time selected database backend.

Exactly one database backend feature (mysql, postgres, or sqlite) selects the concrete sqlx Database used throughout this module. The pool is stored in a process-wide OnceLock and shared by reference, so get_db_pool is effectively free to call from anywhere.

Structs§

PoolSettings
Connection-pool tuning resolved from the database.* configuration namespace.

Functions§

close_db_pool
Gracefully closes the global pool, waiting for in-flight connections to be returned and closed. Intended to be called during shutdown. This is a no-op if the pool was never initialized, so it is always safe to call.
get_db_pool
Returns a reference to the global database pool.
init_db_pool
Initializes the global database pool exactly once.

Type Aliases§

Db
The sqlx database backend selected at compile time.
DbPool
Connection pool for the selected Db backend.