pub struct AsyncPgConnection { /* private fields */ }Available on crate feature
postgres only.Expand description
A connection to a PostgreSQL database.
Connection URLs should be in the form
postgres://[user[:password]@]host/database_name
Checkout the documentation of the tokio_postgres crate for details about the format
Implementations§
Source§impl AsyncPgConnection
impl AsyncPgConnection
Sourcepub async fn try_from(conn: Client) -> ConnectionResult<Self>
pub async fn try_from(conn: Client) -> ConnectionResult<Self>
Construct a new AsyncPgConnection instance from an existing tokio_postgres::Client
Sourcepub fn cancel_token(&self) -> CancelToken
pub fn cancel_token(&self) -> CancelToken
Constructs a cancellation token that can later be used to request cancellation of a query running on the connection associated with this client.
Trait Implementations§
Source§impl AsyncConnection for AsyncPgConnection
impl AsyncConnection for AsyncPgConnection
Source§impl AsyncExecute for AsyncPgConnection
A transaction on a PostgreSQL database.
impl AsyncExecute for AsyncPgConnection
A transaction on a PostgreSQL database.
Supports nested transactions.
Source§impl AsyncTransactional for AsyncPgConnection
impl AsyncTransactional for AsyncPgConnection
Source§type Transaction<'a> = AsyncPgTransaction<'a>
where
Self: 'a
type Transaction<'a> = AsyncPgTransaction<'a> where Self: 'a
The associated transaction type for this connection
Source§async fn begin_transaction(&mut self) -> QueryResult<Self::Transaction<'_>>
async fn begin_transaction(&mut self) -> QueryResult<Self::Transaction<'_>>
Begins a new transaction Read more
Source§impl<Changes, Output, Tab, V> UpdateAndFetchResults<Changes, Output> for AsyncPgConnectionwhere
Output: Send,
Changes: Copy + AsChangeset<Target = Tab> + Send + Identifiable<Table = Tab>,
Tab: Table + FindDsl<Changes::Id>,
Find<Tab, Changes::Id>: IntoUpdateTarget<Table = Tab, WhereClause = V>,
UpdateStatement<Tab, V, Changes::Changeset>: AsQuery,
Update<Changes, Changes>: LoadQuery<Self, Output>,
V: Send,
Changes::Changeset: Send,
Tab::FromClause: Send,
impl<Changes, Output, Tab, V> UpdateAndFetchResults<Changes, Output> for AsyncPgConnectionwhere
Output: Send,
Changes: Copy + AsChangeset<Target = Tab> + Send + Identifiable<Table = Tab>,
Tab: Table + FindDsl<Changes::Id>,
Find<Tab, Changes::Id>: IntoUpdateTarget<Table = Tab, WhereClause = V>,
UpdateStatement<Tab, V, Changes::Changeset>: AsQuery,
Update<Changes, Changes>: LoadQuery<Self, Output>,
V: Send,
Changes::Changeset: Send,
Tab::FromClause: Send,
Source§async fn update_and_fetch(&mut self, changeset: Changes) -> QueryResult<Output>
async fn update_and_fetch(&mut self, changeset: Changes) -> QueryResult<Output>
See the traits documentation.
Auto Trait Implementations§
impl Freeze for AsyncPgConnection
impl !RefUnwindSafe for AsyncPgConnection
impl Send for AsyncPgConnection
impl Sync for AsyncPgConnection
impl Unpin for AsyncPgConnection
impl !UnwindSafe for AsyncPgConnection
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<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
Convert
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
Convert
&self to an expression for Diesel’s query builder. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T, Conn> RunQueryDsl<Conn> for Twhere
T: Send,
impl<T, Conn> RunQueryDsl<Conn> for Twhere
T: Send,
Source§fn execute(
self,
conn: &mut Conn,
) -> impl Future<Output = QueryResult<usize>> + Send
fn execute( self, conn: &mut Conn, ) -> impl Future<Output = QueryResult<usize>> + Send
Executes the given command, returning the number of rows affected. Read more
Source§fn load_stream<U>(
self,
conn: &mut Conn,
) -> impl Future<Output = QueryResult<impl Stream<Item = QueryResult<U>> + Send>> + Sendwhere
Conn: AsyncExecute,
Self: LoadQuery<Conn, U>,
fn load_stream<U>(
self,
conn: &mut Conn,
) -> impl Future<Output = QueryResult<impl Stream<Item = QueryResult<U>> + Send>> + Sendwhere
Conn: AsyncExecute,
Self: LoadQuery<Conn, U>,
Source§fn get_result<U>(
self,
conn: &mut Conn,
) -> impl Future<Output = QueryResult<U>> + Send
fn get_result<U>( self, conn: &mut Conn, ) -> impl Future<Output = QueryResult<U>> + Send
Runs the command, and returns the affected row. Read more
Source§fn get_results<U>(
self,
conn: &mut Conn,
) -> impl Future<Output = QueryResult<Vec<U>>> + Send
fn get_results<U>( self, conn: &mut Conn, ) -> impl Future<Output = QueryResult<Vec<U>>> + Send
Runs the command, returning an
Vec with the affected rows. Read more