pub struct Datasource { /* private fields */ }Expand description
单个具名数据源。
Implementations§
Source§impl Datasource
impl Datasource
Sourcepub fn new(id: DatasourceId, database: AnyDatabase, required: bool) -> Self
pub fn new(id: DatasourceId, database: AnyDatabase, required: bool) -> Self
用逻辑名与数据库容器构造数据源;容器内部身份会被覆盖为同一逻辑名。
Sourcepub fn id(&self) -> &DatasourceId
pub fn id(&self) -> &DatasourceId
返回逻辑数据源名。
Sourcepub fn database(&self) -> &AnyDatabase
pub fn database(&self) -> &AnyDatabase
返回底层数据库容器。
Sourcepub fn is_required(&self) -> bool
pub fn is_required(&self) -> bool
readiness 是否要求该源健康。
Sourcepub fn pool_status(&self) -> PoolStatus
pub fn pool_status(&self) -> PoolStatus
返回连接池状态快照。
Sourcepub async fn health_check(&self) -> Result<bool, DbError>
pub async fn health_check(&self) -> Result<bool, DbError>
执行健康检查。
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Datasource
impl !RefUnwindSafe for Datasource
impl !UnwindSafe for Datasource
impl Forget for Datasource
impl Move for Datasource
impl Send for Datasource
impl Sync for Datasource
impl Unpin for Datasource
impl UnsafeUnpin for Datasource
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> 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