ormio 0.1.0

Working in progress
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use diesel::connection::Connection;
use diesel::pg::PgConnection;
use std::env;

pub struct Database {}

impl Database {
    pub fn get_connection(&self) -> PgConnection {
        let database_url = Database::get_database_url();
        return PgConnection::establish(&database_url)
            .expect(&format!("Error connecting to {}", database_url));
    }

    fn get_database_url() -> String {
        return env::var("DATABASE_URL").expect("DATABASE_URL must be set");
    }
}