use log::LevelFilter; use sea_orm::ConnectOptions; pub mod generated; pub async fn get_connection( connection_string: &str, option_fn: Option, ) -> Result { use sea_orm::Database; let mut opt = ConnectOptions::new(connection_string.to_string()); opt.max_connections(10) .min_connections(0) .connect_timeout(std::time::Duration::from_secs(8)) .idle_timeout(std::time::Duration::from_secs(8)) .test_before_acquire(true) .sqlx_logging(true) .sqlx_logging_level(LevelFilter::Debug); if let Some(option_fn) = option_fn { option_fn(&mut opt); } Database::connect(opt).await }