pub struct Pool { /* private fields */ }Expand description
A MySQL connection pool, with the session zone pinned to UTC on every connection.
Implementations§
Source§impl Pool
impl Pool
Sourcepub async fn connect(url: &str) -> Result<Self, ExecError>
pub async fn connect(url: &str) -> Result<Self, ExecError>
Connect to url (mysql://user:pass@host:port/db).
Sourcepub fn from_pool(inner: MySqlPool) -> Self
pub fn from_pool(inner: MySqlPool) -> Self
Wrap an existing sqlx pool.
The caller then owns the session-zone pin: connections this pool
establishes are not set to time_zone = '+00:00' unless its own
after_connect does so, and TIMESTAMP round-trips are wrong without
it. Prefer Pool::connect.
Trait Implementations§
Source§impl Begin for Pool
impl Begin for Pool
Source§fn begin(&self) -> ExecFuture<'_, Result<Transaction, ExecError>>
fn begin(&self) -> ExecFuture<'_, Result<Transaction, ExecError>>
Open a transaction on a connection this executor owns or checks out.
Source§impl BeginWith for Pool
impl BeginWith for Pool
Source§fn begin_with(
&self,
opts: TxOptions,
) -> ExecFuture<'_, Result<Transaction, ExecError>>
fn begin_with( &self, opts: TxOptions, ) -> ExecFuture<'_, Result<Transaction, ExecError>>
Open a transaction with explicit options. Read more
Source§impl Executor for Pool
impl Executor for Pool
Source§impl StreamExecutor for Pool
impl StreamExecutor for Pool
Source§fn fetch_stream(
&self,
stmt: Statement,
) -> ExecFuture<'_, Result<RowStream, ExecError>>
fn fetch_stream( &self, stmt: Statement, ) -> ExecFuture<'_, Result<RowStream, ExecError>>
Run a statement and hand rows back incrementally. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Pool
impl !UnwindSafe for Pool
impl Freeze for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl UnsafeUnpin for Pool
Blanket Implementations§
Source§impl<B> Atomic for B
impl<B> Atomic for B
Source§impl<B> BeginWithExt for B
impl<B> BeginWithExt for B
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more