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
279 B
Rust
Raw Normal View History

2020-03-12 23:20:34 +03:00
use super::config;
2019-12-29 01:11:34 +03:00
use diesel::prelude::*;
use diesel::pg::PgConnection;
pub fn establish_connection() -> PgConnection {
2020-03-12 23:20:34 +03:00
let database_url = config::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))
}