use diesel::pg::PgConnection; use std::env; use diesel::Connection; pub async fn establish_connection() -> PgConnection { let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); PgConnection::establish(&database_url).expect(&format!("Error connecting to {}", database_url)) }