pub struct IndexDef {
pub name: String,
pub table_name: String,
pub columns: Vec<String>,
pub unique: bool,
}Expand description
索引定义
Fields§
§name: String索引名称
table_name: String表名
columns: Vec<String>列名列表
unique: bool是否唯一索引
Implementations§
Source§impl IndexDef
impl IndexDef
Sourcepub fn new(
name: impl Into<String>,
table_name: impl Into<String>,
columns: Vec<String>,
) -> Self
pub fn new( name: impl Into<String>, table_name: impl Into<String>, columns: Vec<String>, ) -> Self
创建新的索引定义
Sourcepub fn to_create_sql(&self) -> String
pub fn to_create_sql(&self) -> String
生成创建索引 SQL(使用当前数据库类型)
Sourcepub fn to_create_sql_for(&self, db_type: DatabaseType) -> String
pub fn to_create_sql_for(&self, db_type: DatabaseType) -> String
生成创建索引 SQL(指定数据库类型)
Sourcepub fn to_drop_sql(&self) -> String
pub fn to_drop_sql(&self) -> String
生成删除索引 SQL
Trait Implementations§
Source§impl<'de> Deserialize<'de> for IndexDef
impl<'de> Deserialize<'de> for IndexDef
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 IndexDef
impl RefUnwindSafe for IndexDef
impl Send for IndexDef
impl Sync for IndexDef
impl Unpin for IndexDef
impl UnsafeUnpin for IndexDef
impl UnwindSafe for IndexDef
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