pub struct CreateIndexExecutor;Expand description
Executor for CREATE INDEX statements
Implementations§
Source§impl CreateIndexExecutor
impl CreateIndexExecutor
Sourcepub fn execute(
stmt: &CreateIndexStmt,
database: &mut Database,
) -> Result<String, ExecutorError>
pub fn execute( stmt: &CreateIndexStmt, database: &mut Database, ) -> Result<String, ExecutorError>
Execute a CREATE INDEX statement
§Arguments
stmt- The CREATE INDEX statement AST nodedatabase- The database to create the index in
§Returns
Success message or error
§Examples
use vibesql_ast::{CreateIndexStmt, IndexColumn, OrderDirection};
use vibesql_executor::CreateIndexExecutor;
use vibesql_storage::Database;
let mut db = Database::new();
// First create a table
// ... (table creation code) ...
let stmt = CreateIndexStmt {
index_name: "idx_users_email".to_string(),
if_not_exists: false,
table_name: "users".to_string(),
index_type: vibesql_ast::IndexType::BTree { unique: false },
columns: vec![IndexColumn::Column {
column_name: "email".to_string(),
direction: OrderDirection::Asc,
prefix_length: None,
}],
};
let result = CreateIndexExecutor::execute(&stmt, &mut db);
// assert!(result.is_ok());Auto Trait Implementations§
impl Freeze for CreateIndexExecutor
impl RefUnwindSafe for CreateIndexExecutor
impl Send for CreateIndexExecutor
impl Sync for CreateIndexExecutor
impl Unpin for CreateIndexExecutor
impl UnwindSafe for CreateIndexExecutor
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more