Skip to main content

IndexManager

Struct IndexManager 

Source
pub struct IndexManager { /* private fields */ }
Expand description

索引管理器

Implementations§

Source§

impl IndexManager

Source

pub fn new() -> Self

Source

pub fn create_index(&mut self, table: &str, columns: &[&str])

为表列创建索引(支持复合索引)

Source

pub fn create_unique_index(&mut self, table: &str, columns: &[&str])

创建唯一索引

Source

pub fn drop_index(&mut self, table: &str, columns: &[&str]) -> bool

删除索引

Source

pub fn has_index(&self, table: &str, column: &str) -> bool

检查列是否有索引(单列检查)

Source

pub fn has_composite_index(&self, table: &str, columns: &[&str]) -> bool

检查复合索引是否存在

Source

pub fn get_index(&self, table: &str, column: &str) -> Option<&BTreeIndex>

获取索引(不可变引用,单列)

Source

pub fn get_composite_index( &self, table: &str, columns: &[&str], ) -> Option<&BTreeIndex>

获取复合索引(不可变引用)

Source

pub fn get_index_mut( &mut self, table: &str, column: &str, ) -> Option<&mut BTreeIndex>

获取索引(可变引用,单列)

Source

pub fn get_composite_index_mut( &mut self, table: &str, columns: &[&str], ) -> Option<&mut BTreeIndex>

获取复合索引(可变引用)

Source

pub fn get_table_indexes(&self, table: &str) -> Vec<&IndexMeta>

获取表的所有索引元数据

Source

pub fn drop_table_indexes(&mut self, table: &str)

删除表的所有索引

Source

pub fn find_best_index( &self, table: &str, filter_columns: &[&str], ) -> Option<(&IndexMeta, &BTreeIndex)>

查找适合给定列的最佳索引(用于查询优化)

Trait Implementations§

Source§

impl Debug for IndexManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IndexManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.