Struct deadpool_postgres::Transaction [−][src]
pub struct Transaction<'a> { /* fields omitted */ }
Expand description
A wrapper for tokio_postgres::Transaction
which uses the statement cache
from the client object it was created by.
Implementations
impl<'a> Transaction<'a>
[src]
impl<'a> Transaction<'a>
[src]pub async fn prepare_cached(&self, query: &str) -> Result<Statement, Error>
[src]
pub async fn prepare_cached(&self, query: &str) -> Result<Statement, Error>
[src]Like tokio_postgres::Transaction::prepare
but uses an existing statement from the cache if possible.
pub async fn prepare_typed_cached(
&self,
query: &str,
types: &[Type]
) -> Result<Statement, Error>
[src]
pub async fn prepare_typed_cached(
&self,
query: &str,
types: &[Type]
) -> Result<Statement, Error>
[src]Like tokio_postgres::Transaction::prepare_typed
but uses an existing statement from the cache if possible.
pub async fn transaction(&mut self) -> Result<Transaction<'_>, Error>
[src]
pub async fn transaction(&mut self) -> Result<Transaction<'_>, Error>
[src]Like tokio_postgres::Transaction::transaction
but returns a deadpool-postgres
wrapped transaction with
statement cache support.
pub async fn savepoint<I>(&mut self, name: I) -> Result<Transaction<'_>, Error> where
I: Into<String>,
[src]
pub async fn savepoint<I>(&mut self, name: I) -> Result<Transaction<'_>, Error> where
I: Into<String>,
[src]Like tokio_postgres::Transaction::savepoint
but returns a deadpool-postgres
wrapped transaction with
statement cache support.
Methods from Deref<Target = PgTransaction<'a>>
pub async fn prepare(&'_ self, query: &'_ str) -> Result<Statement, Error>
[src]
pub async fn prepare(&'_ self, query: &'_ str) -> Result<Statement, Error>
[src]Like Client::prepare
.
pub async fn prepare_typed(
&'_ self,
query: &'_ str,
parameter_types: &'_ [Type]
) -> Result<Statement, Error>
[src]
pub async fn prepare_typed(
&'_ self,
query: &'_ str,
parameter_types: &'_ [Type]
) -> Result<Statement, Error>
[src]Like Client::prepare_typed
.
pub async fn query<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<Vec<Row, Global>, Error> where
T: ToStatement + ?Sized,
[src]
pub async fn query<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<Vec<Row, Global>, Error> where
T: ToStatement + ?Sized,
[src]Like Client::query
.
pub async fn query_one<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<Row, Error> where
T: ToStatement + ?Sized,
[src]
pub async fn query_one<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<Row, Error> where
T: ToStatement + ?Sized,
[src]Like Client::query_one
.
pub async fn query_opt<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<Option<Row>, Error> where
T: ToStatement + ?Sized,
[src]
pub async fn query_opt<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<Option<Row>, Error> where
T: ToStatement + ?Sized,
[src]Like Client::query_opt
.
pub async fn query_raw<T, P, I>(
&'_ self,
statement: &'_ T,
params: I
) -> Result<RowStream, Error> where
T: ToStatement + ?Sized,
I: IntoIterator<Item = P>,
P: BorrowToSql,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
[src]
pub async fn query_raw<T, P, I>(
&'_ self,
statement: &'_ T,
params: I
) -> Result<RowStream, Error> where
T: ToStatement + ?Sized,
I: IntoIterator<Item = P>,
P: BorrowToSql,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
[src]Like Client::query_raw
.
pub async fn execute<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<u64, Error> where
T: ToStatement + ?Sized,
[src]
pub async fn execute<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<u64, Error> where
T: ToStatement + ?Sized,
[src]Like Client::execute
.
pub async fn execute_raw<P, I, T>(
&'_ self,
statement: &'_ T,
params: I
) -> Result<u64, Error> where
T: ToStatement + ?Sized,
I: IntoIterator<Item = P>,
P: BorrowToSql,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
[src]
pub async fn execute_raw<P, I, T>(
&'_ self,
statement: &'_ T,
params: I
) -> Result<u64, Error> where
T: ToStatement + ?Sized,
I: IntoIterator<Item = P>,
P: BorrowToSql,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
[src]Like Client::execute_iter
.
pub async fn bind<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<Portal, Error> where
T: ToStatement + ?Sized,
[src]
pub async fn bind<T>(
&'_ self,
statement: &'_ T,
params: &'_ [&'_ (dyn ToSql + '_ + Sync)]
) -> Result<Portal, Error> where
T: ToStatement + ?Sized,
[src]Binds a statement to a set of parameters, creating a Portal
which can be incrementally queried.
Portals only last for the duration of the transaction in which they are created, and can only be used on the connection that created them.
Panics
Panics if the number of parameters provided does not match the number expected.
pub async fn bind_raw<P, T, I>(
&'_ self,
statement: &'_ T,
params: I
) -> Result<Portal, Error> where
T: ToStatement + ?Sized,
I: IntoIterator<Item = P>,
P: BorrowToSql,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
[src]
pub async fn bind_raw<P, T, I>(
&'_ self,
statement: &'_ T,
params: I
) -> Result<Portal, Error> where
T: ToStatement + ?Sized,
I: IntoIterator<Item = P>,
P: BorrowToSql,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
[src]A maximally flexible version of bind
.
pub async fn query_portal(
&'_ self,
portal: &'_ Portal,
max_rows: i32
) -> Result<Vec<Row, Global>, Error>
[src]
pub async fn query_portal(
&'_ self,
portal: &'_ Portal,
max_rows: i32
) -> Result<Vec<Row, Global>, Error>
[src]Continues execution of a portal, returning a stream of the resulting rows.
Unlike query
, portals can be incrementally evaluated by limiting the number of rows returned in each call to
query_portal
. If the requested number is negative or 0, all rows will be returned.
pub async fn query_portal_raw(
&'_ self,
portal: &'_ Portal,
max_rows: i32
) -> Result<RowStream, Error>
[src]
pub async fn query_portal_raw(
&'_ self,
portal: &'_ Portal,
max_rows: i32
) -> Result<RowStream, Error>
[src]The maximally flexible version of query_portal
.
pub async fn copy_in<T, U>(
&'_ self,
statement: &'_ T
) -> Result<CopyInSink<U>, Error> where
T: ToStatement + ?Sized,
U: Buf + 'static + Send,
[src]
pub async fn copy_in<T, U>(
&'_ self,
statement: &'_ T
) -> Result<CopyInSink<U>, Error> where
T: ToStatement + ?Sized,
U: Buf + 'static + Send,
[src]Like Client::copy_in
.
pub async fn copy_out<T>(
&'_ self,
statement: &'_ T
) -> Result<CopyOutStream, Error> where
T: ToStatement + ?Sized,
[src]
pub async fn copy_out<T>(
&'_ self,
statement: &'_ T
) -> Result<CopyOutStream, Error> where
T: ToStatement + ?Sized,
[src]Like Client::copy_out
.
pub async fn simple_query(
&'_ self,
query: &'_ str
) -> Result<Vec<SimpleQueryMessage, Global>, Error>
[src]
pub async fn simple_query(
&'_ self,
query: &'_ str
) -> Result<Vec<SimpleQueryMessage, Global>, Error>
[src]Like Client::simple_query
.
pub async fn batch_execute(&'_ self, query: &'_ str) -> Result<(), Error>
[src]
pub async fn batch_execute(&'_ self, query: &'_ str) -> Result<(), Error>
[src]Like Client::batch_execute
.
pub fn cancel_token(&self) -> CancelToken
[src]
pub fn cancel_token(&self) -> CancelToken
[src]Like Client::cancel_token
.
pub async fn cancel_query<T>(&'_ self, tls: T) -> Result<(), Error> where
T: MakeTlsConnect<Socket>,
[src]
👎 Deprecated since 0.6.0: use Transaction::cancel_token() instead
pub async fn cancel_query<T>(&'_ self, tls: T) -> Result<(), Error> where
T: MakeTlsConnect<Socket>,
[src]use Transaction::cancel_token() instead
Like Client::cancel_query
.
pub async fn cancel_query_raw<S, T>(
&'_ self,
stream: S,
tls: T
) -> Result<(), Error> where
T: TlsConnect<S>,
S: AsyncRead + AsyncWrite + Unpin,
[src]
👎 Deprecated since 0.6.0: use Transaction::cancel_token() instead
pub async fn cancel_query_raw<S, T>(
&'_ self,
stream: S,
tls: T
) -> Result<(), Error> where
T: TlsConnect<S>,
S: AsyncRead + AsyncWrite + Unpin,
[src]use Transaction::cancel_token() instead
Like Client::cancel_query_raw
.
pub async fn transaction(&'_ mut self) -> Result<Transaction<'_>, Error>
[src]
pub async fn transaction(&'_ mut self) -> Result<Transaction<'_>, Error>
[src]Like Client::transaction
, but creates a nested transaction via a savepoint.
Trait Implementations
impl<'a> Deref for Transaction<'a>
[src]
impl<'a> Deref for Transaction<'a>
[src]type Target = PgTransaction<'a>
type Target = PgTransaction<'a>
The resulting type after dereferencing.
fn deref(&self) -> &PgTransaction<'a>
[src]
fn deref(&self) -> &PgTransaction<'a>
[src]Dereferences the value.
impl<'a> DerefMut for Transaction<'a>
[src]
impl<'a> DerefMut for Transaction<'a>
[src]fn deref_mut(&mut self) -> &mut PgTransaction<'a>
[src]
fn deref_mut(&mut self) -> &mut PgTransaction<'a>
[src]Mutably dereferences the value.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Transaction<'a>
impl<'a> Send for Transaction<'a>
impl<'a> Sync for Transaction<'a>
impl<'a> Unpin for Transaction<'a>
impl<'a> !UnwindSafe for Transaction<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,