pub struct AsyncMysqlConnection { /* private fields */ }
Available on crate feature
mysql
only.Expand description
A connection to a MySQL database. Connection URLs should be in the form
mysql://[user[:password]@]host/database_name
Implementations§
Source§impl AsyncMysqlConnection
impl AsyncMysqlConnection
Sourcepub async fn try_from(conn: Conn) -> ConnectionResult<Self>
pub async fn try_from(conn: Conn) -> ConnectionResult<Self>
Wrap an existing mysql_async::Conn
into a async diesel mysql connection
This function constructs a new AsyncMysqlConnection
based on an existing
[mysql_async::Conn]
.
Trait Implementations§
Source§impl AsyncConnection for AsyncMysqlConnection
impl AsyncConnection for AsyncMysqlConnection
Source§type ExecuteFuture<'conn, 'query> = Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'conn>>
type ExecuteFuture<'conn, 'query> = Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'conn>>
The future returned by
AsyncConnection::execute
Source§type LoadFuture<'conn, 'query> = Pin<Box<dyn Future<Output = Result<<AsyncMysqlConnection as AsyncConnection>::Stream<'conn, 'query>, Error>> + Send + 'conn>>
type LoadFuture<'conn, 'query> = Pin<Box<dyn Future<Output = Result<<AsyncMysqlConnection as AsyncConnection>::Stream<'conn, 'query>, Error>> + Send + 'conn>>
The future returned by
AsyncConnection::load
Source§type Stream<'conn, 'query> = Pin<Box<dyn Stream<Item = Result<<AsyncMysqlConnection as AsyncConnection>::Row<'conn, 'query>, Error>> + Send + 'conn>>
type Stream<'conn, 'query> = Pin<Box<dyn Stream<Item = Result<<AsyncMysqlConnection as AsyncConnection>::Row<'conn, 'query>, Error>> + Send + 'conn>>
The inner stream returned by
AsyncConnection::load
Source§type Row<'conn, 'query> = MysqlRow
type Row<'conn, 'query> = MysqlRow
The row type used by the stream returned by
AsyncConnection::load
Source§fn establish<'life0, 'async_trait>(
database_url: &'life0 str,
) -> Pin<Box<dyn Future<Output = ConnectionResult<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn establish<'life0, 'async_trait>(
database_url: &'life0 str,
) -> Pin<Box<dyn Future<Output = ConnectionResult<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Establishes a new connection to the database Read more
Source§fn set_instrumentation(&mut self, instrumentation: impl Instrumentation)
fn set_instrumentation(&mut self, instrumentation: impl Instrumentation)
Set a specific
Instrumentation
implementation for this connectionSource§fn transaction<'a, 'life0, 'async_trait, R, E, F>(
&'life0 mut self,
callback: F,
) -> Pin<Box<dyn Future<Output = Result<R, E>> + Send + 'async_trait>>
fn transaction<'a, 'life0, 'async_trait, R, E, F>( &'life0 mut self, callback: F, ) -> Pin<Box<dyn Future<Output = Result<R, E>> + Send + 'async_trait>>
Executes the given function inside of a database transaction Read more
Source§fn begin_test_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = QueryResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin_test_transaction<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = QueryResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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§impl SimpleAsyncConnection for AsyncMysqlConnection
impl SimpleAsyncConnection for AsyncMysqlConnection
Source§fn batch_execute<'life0, 'life1, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = QueryResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn batch_execute<'life0, 'life1, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = QueryResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute multiple SQL statements within the same string. Read more
Source§impl<'b, Changes, Output> UpdateAndFetchResults<Changes, Output> for AsyncMysqlConnectionwhere
Output: Send,
Changes: Copy + Identifiable + Send + AsChangeset<Target = <Changes as HasTable>::Table> + IntoUpdateTarget,
Changes::Table: FindDsl<Changes::Id> + Send,
Changes::WhereClause: Send,
Changes::Changeset: Send,
Changes::Id: Send,
Update<Changes, Changes>: ExecuteDsl<AsyncMysqlConnection>,
Find<Changes::Table, Changes::Id>: LoadQuery<'b, AsyncMysqlConnection, Output> + Send + 'b,
<Changes::Table as Table>::AllColumns: ValidGrouping<()>,
<<Changes::Table as Table>::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
<Changes::Table as QuerySource>::FromClause: Send,
impl<'b, Changes, Output> UpdateAndFetchResults<Changes, Output> for AsyncMysqlConnectionwhere
Output: Send,
Changes: Copy + Identifiable + Send + AsChangeset<Target = <Changes as HasTable>::Table> + IntoUpdateTarget,
Changes::Table: FindDsl<Changes::Id> + Send,
Changes::WhereClause: Send,
Changes::Changeset: Send,
Changes::Id: Send,
Update<Changes, Changes>: ExecuteDsl<AsyncMysqlConnection>,
Find<Changes::Table, Changes::Id>: LoadQuery<'b, AsyncMysqlConnection, Output> + Send + 'b,
<Changes::Table as Table>::AllColumns: ValidGrouping<()>,
<<Changes::Table as Table>::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
<Changes::Table as QuerySource>::FromClause: Send,
Source§fn update_and_fetch<'life0, 'async_trait>(
&'life0 mut self,
changeset: Changes,
) -> Pin<Box<dyn Future<Output = QueryResult<Output>> + Send + 'async_trait>>where
Changes: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn update_and_fetch<'life0, 'async_trait>(
&'life0 mut self,
changeset: Changes,
) -> Pin<Box<dyn Future<Output = QueryResult<Output>> + Send + 'async_trait>>where
Changes: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
See the traits documentation.
Auto Trait Implementations§
impl !Freeze for AsyncMysqlConnection
impl !RefUnwindSafe for AsyncMysqlConnection
impl Send for AsyncMysqlConnection
impl Sync for AsyncMysqlConnection
impl Unpin for AsyncMysqlConnection
impl !UnwindSafe for AsyncMysqlConnection
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> 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> 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 T
impl<T, Conn> RunQueryDsl<Conn> for T
Source§fn execute<'conn, 'query>(
self,
conn: &'conn mut Conn,
) -> Conn::ExecuteFuture<'conn, 'query>
fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> Conn::ExecuteFuture<'conn, 'query>
Executes the given command, returning the number of rows affected. Read more
Source§fn load<'query, 'conn, U>(
self,
conn: &'conn mut Conn,
) -> LoadFuture<'conn, 'query, Self, Conn, U>
fn load<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> LoadFuture<'conn, 'query, Self, Conn, U>
Source§fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn,
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnection,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn,
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnection,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
Source§fn get_result<'query, 'conn, U>(
self,
conn: &'conn mut Conn,
) -> GetResult<'conn, 'query, Self, Conn, U>
fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> GetResult<'conn, 'query, Self, Conn, U>
Runs the command, and returns the affected row. Read more
Source§fn get_results<'query, 'conn, U>(
self,
conn: &'conn mut Conn,
) -> LoadFuture<'conn, 'query, Self, Conn, U>
fn get_results<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> LoadFuture<'conn, 'query, Self, Conn, U>
Runs the command, returning an
Vec
with the affected rows. Read more