pub struct Transaction<P>{ /* private fields */ }Available on crate feature
transaction only.Expand description
Protocol-agnostic Transaction handlers for any connection pool
Implementations§
Source§impl<P> Transaction<P>where
P: Pool + 'static,
P::Key: Hash + Eq + Send + Sync + Clone + 'static,
P::Connection: 'static,
<P::Connection as Connection>::Error: Send + Sync + 'static,
impl<P> Transaction<P>where
P: Pool + 'static,
P::Key: Hash + Eq + Send + Sync + Clone + 'static,
P::Connection: 'static,
<P::Connection as Connection>::Error: Send + Sync + 'static,
Sourcepub fn new(pool: Arc<P>) -> Self
pub fn new(pool: Arc<P>) -> Self
Create a new Postgres transaction service from a reference-counted Pool
Sourcepub async fn begin(
&self,
key: P::Key,
) -> Result<Uuid, Error<<<P as Pool>::Connection as Connection>::Error>>
pub async fn begin( &self, key: P::Key, ) -> Result<Uuid, Error<<<P as Pool>::Connection as Connection>::Error>>
Begin a Postgres transaction, returning a unique ID for the transaction
Sourcepub async fn query(
&self,
id: Uuid,
key: P::Key,
statement: &str,
parameters: &[Parameter],
) -> Result<<P::Connection as Connection>::RowStream, Error<<<P as Pool>::Connection as Connection>::Error>>
pub async fn query( &self, id: Uuid, key: P::Key, statement: &str, parameters: &[Parameter], ) -> Result<<P::Connection as Connection>::RowStream, Error<<<P as Pool>::Connection as Connection>::Error>>
Query an active Postgres transaction by ID and connection pool key
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for Transaction<P>
impl<P> !RefUnwindSafe for Transaction<P>
impl<P> Send for Transaction<P>
impl<P> Sync for Transaction<P>
impl<P> Unpin for Transaction<P>
impl<P> UnsafeUnpin for Transaction<P>
impl<P> !UnwindSafe for Transaction<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request