r2-data-persistence 0.2.2

This is the data persistence layer for the in class project of the TINF22B6 course at DHBW Karlsruhe. Here we create a OSU-like game which also sends some of the game run data to a server to do statistical analysis with Julia.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use diesel::{Connection, PgConnection};
use dotenvy::dotenv;
use std::env;

pub fn establish_connection() -> PgConnection {
    dotenv().ok();

    let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
    PgConnection::establish(&database_url)
        .unwrap_or_else(|_| panic!("Error connecting to {}", database_url))
}