Fixes the ugly Register User post handler.

This commit is contained in:
Dennis Brentjes
2023-03-30 09:32:24 +02:00
parent 3509a70a6a
commit 70ae15f655
9 changed files with 70 additions and 68 deletions

View 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")
}
}