pub struct SchemaModel {
pub manage_comments: bool,
pub manage_functions: bool,
pub schemas: Vec<String>,
pub tables: Vec<TableModel>,
pub functions: Vec<FunctionModel>,
}Expand description
数据库整体结构:schema 列表 + 表列表。
三种来源都会归一化到该模型:
- Rust struct(期望结构,由
#[derive(DbSchema)]生成) - PostgreSQL 元数据(实际结构,由 introspection 读取)
Fields§
§manage_comments: bool是否把表/字段注释纳入差异管理。默认 false,兼容旧 JSON。
manage_functions: bool是否把数据库函数纳入差异管理。默认 false,兼容旧 JSON。
schemas: Vec<String>需要确保存在的 schema 名称(public 由 PostgreSQL 自带,无需列出)
tables: Vec<TableModel>全部业务表(期望结构或实际结构)
functions: Vec<FunctionModel>数据库函数。函数以 schema + 名称 + identity arguments 唯一标识。
Implementations§
Source§impl SchemaModel
impl SchemaModel
Sourcepub fn new(schemas: Vec<String>, tables: Vec<TableModel>) -> SchemaModel
pub fn new(schemas: Vec<String>, tables: Vec<TableModel>) -> SchemaModel
构造一个完整的结构模型
Sourcepub fn with_functions(
schemas: Vec<String>,
tables: Vec<TableModel>,
functions: Vec<FunctionModel>,
) -> SchemaModel
pub fn with_functions( schemas: Vec<String>, tables: Vec<TableModel>, functions: Vec<FunctionModel>, ) -> SchemaModel
构造包含数据库函数的完整模型。
Sourcepub fn from_tables(tables: Vec<TableModel>) -> SchemaModel
pub fn from_tables(tables: Vec<TableModel>) -> SchemaModel
由一组表构造模型,并自动收集它们所属的 schema(跳过 public)
Trait Implementations§
Source§impl Clone for SchemaModel
impl Clone for SchemaModel
Source§fn clone(&self) -> SchemaModel
fn clone(&self) -> SchemaModel
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 SchemaModel
impl Debug for SchemaModel
Source§impl Default for SchemaModel
impl Default for SchemaModel
Source§fn default() -> SchemaModel
fn default() -> SchemaModel
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SchemaModel
impl<'de> Deserialize<'de> for SchemaModel
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaModel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaModel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SchemaModel
Source§impl PartialEq for SchemaModel
impl PartialEq for SchemaModel
Source§impl Serialize for SchemaModel
impl Serialize for SchemaModel
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for SchemaModel
Auto Trait Implementations§
impl Freeze for SchemaModel
impl RefUnwindSafe for SchemaModel
impl Send for SchemaModel
impl Sync for SchemaModel
impl Unpin for SchemaModel
impl UnsafeUnpin for SchemaModel
impl UnwindSafe for SchemaModel
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