pub struct DatasourceRef(/* private fields */);Expand description
业务作用:携带经过统一校验的 datasource 身份,使各 driver 不依赖临时字符串解释名称。
Implementations§
Source§impl DatasourceRef
impl DatasourceRef
Sourcepub fn new(name: impl AsRef<str>) -> Result<Self>
pub fn new(name: impl AsRef<str>) -> Result<Self>
业务作用:以既有兼容签名校验并固定一个 datasource qualifier。
参数说明:
name:是配置边界或业务计划给出的数据源名。
返回:名称符合有界 canonical 合同时返回拥有型引用;失败时在 anyhow 错误链保留具名原因。
Sourcepub fn try_new(name: impl AsRef<str>) -> Result<Self, DatasourceNameError>
pub fn try_new(name: impl AsRef<str>) -> Result<Self, DatasourceNameError>
业务作用:为 checked 配置与事务入口校验 datasource qualifier 并保留结构化失败分类。
参数说明:
name:是配置边界或业务计划给出的数据源名。
返回:名称符合有界 canonical 合同时返回拥有型引用,否则返回 DatasourceNameError。
Sourcepub fn default_ref() -> Self
pub fn default_ref() -> Self
业务作用:返回默认 datasource 的规范化身份。
参数说明: 无。
返回:名称固定为 default 的拥有型引用。
Trait Implementations§
Source§impl AsRef<str> for DatasourceRef
impl AsRef<str> for DatasourceRef
Source§impl Clone for DatasourceRef
impl Clone for DatasourceRef
Source§impl Debug for DatasourceRef
impl Debug for DatasourceRef
Source§impl Default for DatasourceRef
impl Default for DatasourceRef
Source§impl Display for DatasourceRef
impl Display for DatasourceRef
impl Eq for DatasourceRef
Source§impl Hash for DatasourceRef
impl Hash for DatasourceRef
Source§impl Ord for DatasourceRef
impl Ord for DatasourceRef
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for DatasourceRef
impl PartialEq for DatasourceRef
Source§impl PartialOrd for DatasourceRef
impl PartialOrd for DatasourceRef
impl StructuralPartialEq for DatasourceRef
Auto Trait Implementations§
impl Forget for DatasourceRef
impl Freeze for DatasourceRef
impl Move for DatasourceRef
impl RefUnwindSafe for DatasourceRef
impl Send for DatasourceRef
impl Sync for DatasourceRef
impl Unpin for DatasourceRef
impl UnsafeUnpin for DatasourceRef
impl UnwindSafe for DatasourceRef
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