pub struct EnhancedPoolConfig {
pub max_connections: u32,
pub min_idle: Option<u32>,
pub acquire_timeout: Duration,
pub idle_timeout: Option<Duration>,
pub max_lifetime: Option<Duration>,
pub test_on_acquire: bool,
pub test_query: String,
pub pool_name: Option<String>,
}Expand description
增强的连接池配置。
提供 比 sqlx::PoolOptions 更丰富的配置项,包括健康检查、测试查询等。
Fields§
§max_connections: u32最大连接数(默认 10)
min_idle: Option<u32>最小空闲连接数(默认 0)
acquire_timeout: Duration获取连接超时时间(默认 30 秒)
idle_timeout: Option<Duration>空闲连接超时时间(默认 600 秒)
max_lifetime: Option<Duration>连接最大生存时间(默认 1800 秒)
test_on_acquire: bool获取连接时是否执行测试查询(默认 false)
test_query: String测试查询 SQL(默认 “SELECT 1”)
pool_name: Option<String>连接池名称(用于日志和监控)
Implementations§
Trait Implementations§
Source§impl Clone for EnhancedPoolConfig
impl Clone for EnhancedPoolConfig
Source§fn clone(&self) -> EnhancedPoolConfig
fn clone(&self) -> EnhancedPoolConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnhancedPoolConfig
impl Debug for EnhancedPoolConfig
Auto Trait Implementations§
impl Freeze for EnhancedPoolConfig
impl RefUnwindSafe for EnhancedPoolConfig
impl Send for EnhancedPoolConfig
impl Sync for EnhancedPoolConfig
impl Unpin for EnhancedPoolConfig
impl UnsafeUnpin for EnhancedPoolConfig
impl UnwindSafe for EnhancedPoolConfig
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> 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