diesel::r2d2

Struct PooledConnection

Source
pub struct PooledConnection<M>{ /* private fields */ }
Available on crate feature r2d2 only.
Expand description

A smart pointer wrapping a connection.

Implementations§

Source§

impl<M> PooledConnection<M>

Source

pub fn extensions(this: &PooledConnection<M>) -> &Extensions

Returns a shared reference to the extensions associated with this connection.

Source

pub fn extensions_mut(this: &mut PooledConnection<M>) -> &mut Extensions

Returns a mutable reference to the extensions associated with this connection.

Trait Implementations§

Source§

impl<M> Connection for PooledConnection<M>

Source§

type Backend = <<M as ManageConnection>::Connection as Connection>::Backend

The backend this type connects to
Source§

type TransactionManager = PoolTransactionManager<<<M as ManageConnection>::Connection as Connection>::TransactionManager>

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
The transaction manager implementation used by this connection
Source§

fn establish(_: &str) -> ConnectionResult<Self>

Establishes a new connection to the database Read more
Source§

fn begin_test_transaction(&mut self) -> QueryResult<()>

Creates a transaction that will never be committed. This is useful for tests. Panics if called while inside of a transaction or if called with a connection containing a broken transaction
Source§

fn execute_returning_count<T>(&mut self, source: &T) -> QueryResult<usize>
where T: QueryFragment<Self::Backend> + QueryId,

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Execute a single SQL statements given by a query and return number of affected rows
Source§

fn transaction_state( &mut self, ) -> &mut <Self::TransactionManager as TransactionManager<Self>>::TransactionStateData

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Get access to the current transaction state of this connection Read more
Source§

fn instrumentation(&mut self) -> &mut dyn Instrumentation

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Get the instrumentation instance stored in this connection
Source§

fn set_instrumentation(&mut self, instrumentation: impl Instrumentation)

Set a specific Instrumentation implementation for this connection
Source§

fn transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
where F: FnOnce(&mut Self) -> Result<T, E>, E: From<Error>,

Executes the given function inside of a database transaction Read more
Source§

fn test_transaction<T, E, F>(&mut self, f: F) -> T
where F: FnOnce(&mut Self) -> Result<T, E>, E: Debug,

Executes the given function inside a transaction, but does not commit it. Panics if the given function returns an error. Read more
Source§

impl<M> Debug for PooledConnection<M>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<M> Deref for PooledConnection<M>

Source§

type Target = <M as ManageConnection>::Connection

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<M as ManageConnection>::Connection

Dereferences the value.
Source§

impl<M> DerefMut for PooledConnection<M>

Source§

fn deref_mut(&mut self) -> &mut <M as ManageConnection>::Connection

Mutably dereferences the value.
Source§

impl<M> Drop for PooledConnection<M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T, A, C> ExecuteCopyFromDsl<PooledConnection<ConnectionManager<C>>> for CopyFromQuery<T, A>
where A: CopyFromExpression<T>, C: R2D2Connection<Backend = Pg> + 'static, Self: ExecuteCopyFromDsl<C>,

Available on crate feature postgres_backend only.
Source§

type Error = <CopyFromQuery<T, A> as ExecuteCopyFromDsl<C>>::Error

The error type returned by the execute function
Source§

fn execute( self, conn: &mut PooledConnection<ConnectionManager<C>>, ) -> Result<usize, Self::Error>

See the trait documentation for details
Source§

impl<B, M> LoadConnection<B> for PooledConnection<M>

Source§

type Cursor<'conn, 'query> = <<M as ManageConnection>::Connection as LoadConnection<B>>::Cursor<'conn, 'query>

The cursor type returned by LoadConnection::load Read more
Source§

type Row<'conn, 'query> = <<M as ManageConnection>::Connection as LoadConnection<B>>::Row<'conn, 'query>

The row type used as Iterator::Item for the iterator implementation of LoadConnection::Cursor
Source§

fn load<'conn, 'query, T>( &'conn mut self, source: T, ) -> QueryResult<Self::Cursor<'conn, 'query>>
where T: Query + QueryFragment<Self::Backend> + QueryId + 'query, Self::Backend: QueryMetadata<T::SqlType>,

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Executes a given query and returns any requested values Read more
Source§

impl<M> MigrationConnection for PooledConnection<M>

Source§

fn setup(&mut self) -> QueryResult<usize>

Setup the following table: Read more
Source§

impl<M> SimpleConnection for PooledConnection<M>
where M: ManageConnection, M::Connection: R2D2Connection + Send + 'static,

Source§

fn batch_execute(&mut self, query: &str) -> QueryResult<()>

Execute multiple SQL statements within the same string. Read more
Source§

impl<Changes, Output, M> UpdateAndFetchResults<Changes, Output> for PooledConnection<M>
where M: ManageConnection, M::Connection: UpdateAndFetchResults<Changes, Output>, Self: Connection,

Source§

fn update_and_fetch(&mut self, changeset: Changes) -> QueryResult<Output>

See the traits documentation.
Source§

impl<M> ConnectionSealed for PooledConnection<M>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<C> BoxableConnection<<C as Connection>::Backend> for C
where C: Connection + Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Maps the current connection to std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> AsExprOf<Self, T>

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T>
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Formattable for T
where T: Deref, <T as Deref>::Target: Formattable,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> Parsable for T
where T: Deref, <T as Deref>::Target: Parsable,