pub struct IndexManager { /* private fields */ }Expand description
索引管理器
Implementations§
Source§impl IndexManager
impl IndexManager
pub fn new() -> Self
Sourcepub fn create_index(&mut self, table: &str, columns: &[&str])
pub fn create_index(&mut self, table: &str, columns: &[&str])
为表列创建索引(支持复合索引)
Sourcepub fn create_unique_index(&mut self, table: &str, columns: &[&str])
pub fn create_unique_index(&mut self, table: &str, columns: &[&str])
创建唯一索引
Sourcepub fn drop_index(&mut self, table: &str, columns: &[&str]) -> bool
pub fn drop_index(&mut self, table: &str, columns: &[&str]) -> bool
删除索引
Sourcepub fn has_composite_index(&self, table: &str, columns: &[&str]) -> bool
pub fn has_composite_index(&self, table: &str, columns: &[&str]) -> bool
检查复合索引是否存在
Sourcepub fn get_composite_index(
&self,
table: &str,
columns: &[&str],
) -> Option<&BTreeIndex>
pub fn get_composite_index( &self, table: &str, columns: &[&str], ) -> Option<&BTreeIndex>
获取复合索引(不可变引用)
Sourcepub fn get_index_mut(
&mut self,
table: &str,
column: &str,
) -> Option<&mut BTreeIndex>
pub fn get_index_mut( &mut self, table: &str, column: &str, ) -> Option<&mut BTreeIndex>
获取索引(可变引用,单列)
Sourcepub fn get_composite_index_mut(
&mut self,
table: &str,
columns: &[&str],
) -> Option<&mut BTreeIndex>
pub fn get_composite_index_mut( &mut self, table: &str, columns: &[&str], ) -> Option<&mut BTreeIndex>
获取复合索引(可变引用)
Sourcepub fn get_table_indexes(&self, table: &str) -> Vec<&IndexMeta>
pub fn get_table_indexes(&self, table: &str) -> Vec<&IndexMeta>
获取表的所有索引元数据
Sourcepub fn drop_table_indexes(&mut self, table: &str)
pub fn drop_table_indexes(&mut self, table: &str)
删除表的所有索引
Sourcepub fn find_best_index(
&self,
table: &str,
filter_columns: &[&str],
) -> Option<(&IndexMeta, &BTreeIndex)>
pub fn find_best_index( &self, table: &str, filter_columns: &[&str], ) -> Option<(&IndexMeta, &BTreeIndex)>
查找适合给定列的最佳索引(用于查询优化)
Trait Implementations§
Source§impl Debug for IndexManager
impl Debug for IndexManager
Auto Trait Implementations§
impl Freeze for IndexManager
impl RefUnwindSafe for IndexManager
impl Send for IndexManager
impl Sync for IndexManager
impl Unpin for IndexManager
impl UnsafeUnpin for IndexManager
impl UnwindSafe for IndexManager
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