Archived
1
0
Fork 0
This repository has been archived on 2024-07-25. You can view files and clone it, but cannot push or open issues or pull requests.
enve/examples/diesel/src/db.rs

10 lines
273 B
Rust
Raw Normal View History

2019-12-29 01:11:34 +03:00
use super::cfg;
use diesel::prelude::*;
use diesel::pg::PgConnection;
pub fn establish_connection() -> PgConnection {
let database_url = cfg::DATABASE_URL();
2020-02-08 22:11:37 +03:00
PgConnection::establish(database_url)
2019-12-29 01:11:34 +03:00
.expect(&format!("Error connecting to {}", database_url))
}