Skip to main content

init_db_pool

Function init_db_pool 

Source
pub async fn init_db_pool()
Expand description

Initializes the global database pool exactly once.

This function should be called early in your application’s lifecycle (for example, in your main function). It reads the configuration for the maximum number of database connections and the database URL. If no value is provided for the maximum connections, it defaults to 10.

§Panics

  • If no database URL is provided in the configuration.
  • If the pool fails to be created.
  • If the global pool is already initialized.