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]
.
Sourcepub fn cancel_token(&self) -> MysqlCancelToken
pub fn cancel_token(&self) -> MysqlCancelToken
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 AsyncMysqlConnection
impl AsyncConnection for AsyncMysqlConnection
Source§async fn establish(database_url: &str) -> ConnectionResult<Self>
async fn establish(database_url: &str) -> ConnectionResult<Self>
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 set_prepared_statement_cache_size(&mut self, size: CacheSize)
fn set_prepared_statement_cache_size(&mut self, size: CacheSize)
Set the prepared statement cache size to
CacheSize
for this connectionSource§fn transaction<'a, 'conn, R, E, F>(
&'conn mut self,
callback: F,
) -> BoxFuture<'conn, Result<R, E>>
fn transaction<'a, 'conn, R, E, F>( &'conn mut self, callback: F, ) -> BoxFuture<'conn, Result<R, E>>
Executes the given function inside of a database transaction Read more
Source§fn begin_test_transaction(
&mut self,
) -> impl Future<Output = QueryResult<()>> + Send
fn begin_test_transaction( &mut self, ) -> impl Future<Output = QueryResult<()>> + Send
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 AsyncConnectionCore for AsyncMysqlConnection
impl AsyncConnectionCore 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 AsyncConnectionCore>::Stream<'conn, 'query>, Error>> + Send + 'conn>>
type LoadFuture<'conn, 'query> = Pin<Box<dyn Future<Output = Result<<AsyncMysqlConnection as AsyncConnectionCore>::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 AsyncConnectionCore>::Row<'conn, 'query>, Error>> + Send + 'conn>>
type Stream<'conn, 'query> = Pin<Box<dyn Stream<Item = Result<<AsyncMysqlConnection as AsyncConnectionCore>::Row<'conn, 'query>, Error>> + Send + 'conn>>
The inner stream returned by
AsyncConnection::load
Source§impl SimpleAsyncConnection for AsyncMysqlConnection
impl SimpleAsyncConnection for AsyncMysqlConnection
Source§async fn batch_execute(&mut self, query: &str) -> QueryResult<()>
async fn batch_execute(&mut self, query: &str) -> QueryResult<()>
Execute multiple SQL statements within the same string. Read more
Source§impl<'b, Changes, Output, Tab, V> UpdateAndFetchResults<Changes, Output> for AsyncMysqlConnectionwhere
Output: Send + 'static,
Changes: Copy + AsChangeset<Target = Tab> + Send + Identifiable<Table = Tab>,
Tab: Table + FindDsl<Changes::Id> + 'b,
Find<Tab, Changes::Id>: IntoUpdateTarget<Table = Tab, WhereClause = V>,
UpdateStatement<Tab, V, Changes::Changeset>: AsQuery,
Update<Changes, Changes>: ExecuteDsl<Self>,
V: Send + 'b,
Changes::Changeset: Send + 'b,
Changes::Id: 'b,
Tab::FromClause: Send,
Find<Changes::Table, Changes::Id>: LoadQuery<'b, AsyncMysqlConnection, Output> + Send,
impl<'b, Changes, Output, Tab, V> UpdateAndFetchResults<Changes, Output> for AsyncMysqlConnectionwhere
Output: Send + 'static,
Changes: Copy + AsChangeset<Target = Tab> + Send + Identifiable<Table = Tab>,
Tab: Table + FindDsl<Changes::Id> + 'b,
Find<Tab, Changes::Id>: IntoUpdateTarget<Table = Tab, WhereClause = V>,
UpdateStatement<Tab, V, Changes::Changeset>: AsQuery,
Update<Changes, Changes>: ExecuteDsl<Self>,
V: Send + 'b,
Changes::Changeset: Send + 'b,
Changes::Id: 'b,
Tab::FromClause: Send,
Find<Changes::Table, Changes::Id>: LoadQuery<'b, AsyncMysqlConnection, Output> + Send,
Source§fn update_and_fetch<'conn, 'changes>(
&'conn mut self,
changeset: Changes,
) -> BoxFuture<'changes, QueryResult<Output>>where
Changes: 'changes,
Changes::Changeset: 'changes,
Self: 'changes,
'conn: 'changes,
fn update_and_fetch<'conn, 'changes>(
&'conn mut self,
changeset: Changes,
) -> BoxFuture<'changes, QueryResult<Output>>where
Changes: 'changes,
Changes::Changeset: 'changes,
Self: 'changes,
'conn: 'changes,
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> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT
modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL
modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Add an aggregate function filter Read more
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Add an aggregate function order Read more
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
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, 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: AsyncConnectionCore,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
fn load_stream<'conn, 'query, U>(
self,
conn: &'conn mut Conn,
) -> Self::LoadFuture<'conn>where
Conn: AsyncConnectionCore,
U: 'conn,
Self: LoadQuery<'query, Conn, U> + 'query,
Executes the given query, returning a [
Stream
] with the returned rows. Read moreSource§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 moreSource§impl<T> WindowExpressionMethods for T
impl<T> WindowExpressionMethods for T
Source§fn over(self) -> Self::Outputwhere
Self: OverDsl,
fn over(self) -> Self::Outputwhere
Self: OverDsl,
Turn a function call into a window function call Read more
Source§fn window_filter<P>(self, f: P) -> Self::Output
fn window_filter<P>(self, f: P) -> Self::Output
Add a filter to the current window function Read more
Source§fn partition_by<E>(self, expr: E) -> Self::Outputwhere
Self: PartitionByDsl<E>,
fn partition_by<E>(self, expr: E) -> Self::Outputwhere
Self: PartitionByDsl<E>,
Add a partition clause to the current window function Read more
Source§fn window_order<E>(self, expr: E) -> Self::Outputwhere
Self: OrderWindowDsl<E>,
fn window_order<E>(self, expr: E) -> Self::Outputwhere
Self: OrderWindowDsl<E>,
Add a order clause to the current window function Read more