pub struct DataSourcePoolConfig {
pub url: String,
pub max_connections: u32,
pub min_connections: u32,
pub acquire_timeout_ms: u64,
pub connect_timeout_ms: u64,
pub probe_on_start: bool,
}Expand description
业务作用:承载两种数据库连接池共同使用的启动配置,不解释具体 URL scheme。
Fields§
§url: String数据库连接串;driver 包装层负责校验 scheme。
max_connections: u32连接池上限。
min_connections: u32连接池下限。
acquire_timeout_ms: u64从池中获取连接的等待上限,毫秒。
connect_timeout_ms: u64建立单条连接的等待上限,毫秒。
probe_on_start: bool启动时是否先执行真实单连接探测。
Implementations§
Source§impl DataSourcePoolConfig
impl DataSourcePoolConfig
Sourcepub fn validate_common(&self) -> Result<(), PoolConfigError>
pub fn validate_common(&self) -> Result<(), PoolConfigError>
业务作用:校验与 driver 无关的池容量和超时合同。
参数说明: 无。
返回:公共配置可用于建池时返回 Ok;失败时不产生连接副作用。
Trait Implementations§
Source§impl Clone for DataSourcePoolConfig
impl Clone for DataSourcePoolConfig
Source§impl Debug for DataSourcePoolConfig
impl Debug for DataSourcePoolConfig
Source§impl<'de> Deserialize<'de> for DataSourcePoolConfig
impl<'de> Deserialize<'de> for DataSourcePoolConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for DataSourcePoolConfig
impl Freeze for DataSourcePoolConfig
impl Move for DataSourcePoolConfig
impl RefUnwindSafe for DataSourcePoolConfig
impl Send for DataSourcePoolConfig
impl Sync for DataSourcePoolConfig
impl Unpin for DataSourcePoolConfig
impl UnsafeUnpin for DataSourcePoolConfig
impl UnwindSafe for DataSourcePoolConfig
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