pub struct Helge<C> where
C: R2D2Connection + Send + 'static, { /* private fields */ }Expand description
The main wrapper, simply contains an r2d2::Pool
Implementations
sourceimpl<C> Helge<C> where
C: R2D2Connection + Send + 'static,
impl<C> Helge<C> where
C: R2D2Connection + Send + 'static,
sourcepub fn new(database_uri: impl Into<String>) -> Result<Self, ConnectionError>
pub fn new(database_uri: impl Into<String>) -> Result<Self, ConnectionError>
Create a new Helge with default settings
pub fn from_pool(pool: Pool<ConnectionManager<C>>) -> Self
pub fn get_conn(&self) -> Result<PooledConnection<ConnectionManager<C>>, Error>
pub async fn query<T, F>(&self, f: F) -> Result<T, Error> where
T: Send + 'static,
F: FnOnce(&mut C) -> Result<T, Error> + Send + 'static,
pub async fn run<T, E, F>(&self, f: F) -> Result<T, E> where
T: Send + 'static,
E: From<Error> + Send + 'static,
F: FnOnce(&mut C) -> Result<T, E> + Send + 'static,
Trait Implementations
Auto Trait Implementations
impl<C> !RefUnwindSafe for Helge<C>
impl<C> Send for Helge<C>
impl<C> Sync for Helge<C>
impl<C> Unpin for Helge<C>
impl<C> !UnwindSafe for Helge<C>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
Convert self to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
T: SqlType + TypedExpressionType,
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
T: SqlType + TypedExpressionType,
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel’s query builder. Read more