Struct sea_schema::sqlite::def::TableDef
source ยท pub struct TableDef {
pub name: String,
pub foreign_keys: Vec<ForeignKeysInfo>,
pub indexes: Vec<IndexInfo>,
pub constraints: Vec<IndexInfo>,
pub columns: Vec<ColumnInfo>,
pub auto_increment: bool,
}
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
indexes: Vec<IndexInfo>
A list of the indexes in the table
constraints: Vec<IndexInfo>
A list of UNIQUE and PRIMARY KEY constraints on the table
columns: Vec<ColumnInfo>
A list of all the columns and their types
auto_increment: bool
Whether the primary key should autoincrement
Implementationsยง
sourceยงimpl 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_constraints(
&mut self,
executor: &Executor
) -> DiscoveryResult<()>
pub async fn get_constraints( &mut self, executor: &Executor ) -> DiscoveryResult<()>
Get a list of most of the UNIQUE and PRIMARY KEY constraints on the table.
These are implemented by indexes in most cases. These indexes have type โuโ or โpkโ.
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_indexes(&mut self, executor: &Executor) -> DiscoveryResult<()>
pub async fn get_indexes(&mut self, executor: &Executor) -> 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