pub struct SchemaConfig {
pub databases: Vec<DatabaseSchema>,
pub default_database: Option<String>,
}Expand description
完整的 schema 配置(包含多个数据库)
Fields§
§databases: Vec<DatabaseSchema>数据库列表
default_database: Option<String>默认数据库名称(可选,不指定则使用第一个数据库)
Implementations§
Source§impl SchemaConfig
impl SchemaConfig
Sourcepub fn database(self, database: DatabaseSchema) -> Self
pub fn database(self, database: DatabaseSchema) -> Self
添加数据库
Sourcepub fn default_database(self, name: impl Into<String>) -> Self
pub fn default_database(self, name: impl Into<String>) -> Self
设置默认数据库
Sourcepub fn get_default_database(&self) -> Option<&DatabaseSchema>
pub fn get_default_database(&self) -> Option<&DatabaseSchema>
获取默认数据库
Sourcepub fn get_database(&self, name: &str) -> Option<&DatabaseSchema>
pub fn get_database(&self, name: &str) -> Option<&DatabaseSchema>
根据名称获取数据库
Trait Implementations§
Source§impl Clone for SchemaConfig
impl Clone for SchemaConfig
Source§fn clone(&self) -> SchemaConfig
fn clone(&self) -> SchemaConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 SchemaConfig
impl Debug for SchemaConfig
Source§impl<'de> Deserialize<'de> for SchemaConfig
impl<'de> Deserialize<'de> for SchemaConfig
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 Freeze for SchemaConfig
impl RefUnwindSafe for SchemaConfig
impl Send for SchemaConfig
impl Sync for SchemaConfig
impl Unpin for SchemaConfig
impl UnsafeUnpin for SchemaConfig
impl UnwindSafe for SchemaConfig
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