pub struct TableSchema {
pub name: String,
pub schema: Option<String>,
pub comment: Option<String>,
pub indexes: Option<Vec<Index>>,
pub columns: Vec<Column>,
pub from: Option<String>,
pub recreate: Option<String>,
pub trim_columns: bool,
pub trim_indexes: bool,
pub query_only: bool,
}
Fields§
§name: String
表名称
schema: Option<String>
表所属 schema
comment: Option<String>
说明信息
indexes: Option<Vec<Index>>
索引
columns: Vec<Column>
列
from: Option<String>
[控制字段] 从另外一个表重命名, 执行重命名的前提条件:1 该表不存在,2 from 指定的表必须存在
recreate: Option<String>
[控制字段] 删除并重建表,给出一个与该表关联的唯一重建标志 当 重建标志 标志第一次出现时,该表将会重建 重建会删除表内所有数据,请慎重使用
trim_columns: bool
[控制字段] 删除没有关联 struct 字段的表中的列
trim_indexes: bool
[控制字段] 删除未定义的索引
query_only: bool
[控制字段] 是否生成增删改相关函数 true 不生成 false 生成
Implementations§
Source§impl TableSchema
impl TableSchema
pub fn name_with_schema(&self) -> String
pub fn index_name_with_schema(&self, index_name: &String) -> String
Sourcepub fn check_indexes_columns(&self) -> Result<()>
pub fn check_indexes_columns(&self) -> Result<()>
检查索引列是否合法 有效索引列为表中列的字段名称
pub fn find_column(&self, name: &String) -> Option<Column>
Sourcepub fn assign(&mut self, source: TableSchema) -> Result<()>
pub fn assign(&mut self, source: TableSchema) -> Result<()>
合并 source 属性到当前 Table
Trait Implementations§
Source§impl Clone for TableSchema
impl Clone for TableSchema
Source§fn clone(&self) -> TableSchema
fn clone(&self) -> TableSchema
Returns a copy 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 TableSchema
impl Debug for TableSchema
Source§impl Default for TableSchema
impl Default for TableSchema
Source§fn default() -> TableSchema
fn default() -> TableSchema
Returns the “default value” for a type. Read more
Source§impl Parse for TableSchema
impl Parse for TableSchema
fn parse(input: ParseStream<'_>) -> Result<Self>
Source§impl ToTokens for TableSchema
impl ToTokens for TableSchema
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for TableSchema
impl RefUnwindSafe for TableSchema
impl Send for TableSchema
impl Sync for TableSchema
impl Unpin for TableSchema
impl UnwindSafe for TableSchema
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.