pub struct TableSchema {
pub name: String,
pub columns: Vec<Column>,
}Expand description
表结构定义
Fields§
§name: String§columns: Vec<Column>Implementations§
Source§impl TableSchema
impl TableSchema
pub fn new(name: impl Into<String>, columns: Vec<Column>) -> Self
Sourcepub fn column_index(&self, name: &str) -> Option<usize>
pub fn column_index(&self, name: &str) -> Option<usize>
根据列名获取列索引
Sourcepub fn primary_key(&self) -> Option<&Column>
pub fn primary_key(&self) -> Option<&Column>
获取主键列
Sourcepub fn auto_increment_column(&self) -> Option<&Column>
pub fn auto_increment_column(&self) -> Option<&Column>
获取自增列
Sourcepub fn fill_defaults(&self, row: &mut Row)
pub fn fill_defaults(&self, row: &mut Row)
填充行的默认值 对于行中缺少的列,如果该列有默认值,则自动填充
Trait Implementations§
Source§impl Clone for TableSchema
impl Clone for TableSchema
Source§fn clone(&self) -> TableSchema
fn clone(&self) -> TableSchema
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 TableSchema
impl Debug for TableSchema
Source§impl<'de> Deserialize<'de> for TableSchema
impl<'de> Deserialize<'de> for TableSchema
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 TableSchema
impl RefUnwindSafe for TableSchema
impl Send for TableSchema
impl Sync for TableSchema
impl Unpin for TableSchema
impl UnsafeUnpin 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