diesel_postgres_composite_type/lib.rs
1pub mod schema;
2
3use diesel::prelude::*;
4use dotenvy::dotenv;
5use std::env;
6
7pub fn establish_connection() -> PgConnection {
8 dotenv().ok();
9
10 let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
11 PgConnection::establish(&database_url)
12 .unwrap_or_else(|_| panic!("Error connecting to {}", database_url))
13}