forked from Roflin/gamenight
Fixes the ugly Register User post handler.
This commit is contained in:
11
backend-actix/src/util/mod.rs
Normal file
11
backend-actix/src/util/mod.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use diesel::{r2d2::{PooledConnection, ManageConnection, Pool}};
|
||||
|
||||
pub trait GetConnection<T> where T: ManageConnection {
|
||||
fn get_conn(&self) -> PooledConnection<T>;
|
||||
}
|
||||
|
||||
impl<T: ManageConnection> GetConnection<T> for Pool<T> {
|
||||
fn get_conn(&self) -> PooledConnection<T> {
|
||||
self.get().expect("Couldn't get db connection from pool")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user