pub enum Pool {
Pg(PgPool),
My(MySqlPool),
Sq(SqlitePool),
}Expand description
三种原生池。方言由变体本身承载 —— 不再解析 URL 猜测。
Clone:sqlx 的池内部是 Arc,克隆只是多一个句柄(metrics feature 的
collector 要长期持有池)。
Variants§
Implementations§
Source§impl Pool
impl Pool
Sourcepub async fn connect(url: &str, params: &PoolParams) -> Result<Self, Error>
pub async fn connect(url: &str, params: &PoolParams) -> Result<Self, Error>
按 URL scheme 建立对应的原生池。
Sourcepub async fn connect_with_mysql_compat(
url: &str,
params: &PoolParams,
compat: MysqlCompat,
) -> Result<Self, Error>
pub async fn connect_with_mysql_compat( url: &str, params: &PoolParams, compat: MysqlCompat, ) -> Result<Self, Error>
同 Pool::connect,但可指定 MySQL 协议兼容模式。
pub fn dialect(&self) -> Dialect
Sourcepub fn max_connections(&self) -> u32
pub fn max_connections(&self) -> u32
池配置的最大连接数(预算校验用)。注意 Pool::size 是当前已建立数,
空闲池的 size() 不是上限。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Pool
impl !UnwindSafe for Pool
impl Forget 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<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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request