pub struct TableDef {
pub name: String,
pub foreign_keys: Vec<ForeignKeysInfo>,
pub columns: Vec<ColumnInfo>,
pub auto_increment: bool,
}
Available on crate features
sqlite
and def
only.Expand description
Defines a table for SQLite
Fields
name: String
The table name
foreign_keys: Vec<ForeignKeysInfo>
A list of foreign keys in the table
columns: Vec<ColumnInfo>
A list of all the columns and their types
auto_increment: bool
Whether the primary key should autoincrement
Implementations
sourceimpl TableDef
impl TableDef
sourcepub async fn pk_is_autoincrement(
&mut self,
executor: &Executor
) -> DiscoveryResult<&mut Self>
pub async fn pk_is_autoincrement(
&mut self,
executor: &Executor
) -> DiscoveryResult<&mut Self>
Check if the primary key in the table is set to autoincrement as a result of using query `SELECT COUNT(*) from sqlite_sequence where name = ‘table_name’;
sourcepub async fn get_indexes(
&mut self,
executor: &Executor,
indexes: &mut Vec<IndexInfo>
) -> DiscoveryResult<()>
pub async fn get_indexes(
&mut self,
executor: &Executor,
indexes: &mut Vec<IndexInfo>
) -> DiscoveryResult<()>
Get a list of all the indexes in the table.
Note that this does not get the column name mapped by the index.
To get the column name mapped by the index, the self.get_single_indexinfo
method is invoked
sourcepub async fn get_foreign_keys(
&mut self,
executor: &Executor
) -> DiscoveryResult<&mut Self>
pub async fn get_foreign_keys(
&mut self,
executor: &Executor
) -> DiscoveryResult<&mut Self>
Get a list of all the foreign keys in the table
sourcepub async fn get_column_info(
&mut self,
executor: &Executor
) -> DiscoveryResult<&TableDef>
pub async fn get_column_info(
&mut self,
executor: &Executor
) -> DiscoveryResult<&TableDef>
Get a list of all the columns in the table mapped as ColumnInfo
pub fn write(&self) -> TableCreateStatement
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TableDef
impl Send for TableDef
impl Sync for TableDef
impl Unpin for TableDef
impl UnwindSafe for TableDef
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more