pub struct VaporDB {
pub connection: Connection,
pub db_path: String,
pub bookmark_manager: Option<BookmarkManager>,
pub transaction_manager: TransactionManager,
}Expand description
A high-level API for interacting with SQLite databases through vapor-cli
This struct provides a simplified interface to vapor-cli’s functionality, making it easy to use as a library in other Rust projects.
Fields§
§connection: Connection§db_path: String§bookmark_manager: Option<BookmarkManager>§transaction_manager: TransactionManagerImplementations§
Source§impl VaporDB
impl VaporDB
Sourcepub fn open<P: AsRef<Path>>(db_path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(db_path: P) -> Result<Self>
Create a new VaporDB instance with an existing database
Sourcepub fn create<P: AsRef<Path>>(db_path: P) -> Result<Self>
pub fn create<P: AsRef<Path>>(db_path: P) -> Result<Self>
Create a new database and return a VaporDB instance
Sourcepub fn execute_with_options(
&self,
sql: &str,
options: &QueryOptions,
) -> Result<()>
pub fn execute_with_options( &self, sql: &str, options: &QueryOptions, ) -> Result<()>
Execute a SQL query with custom options
Sourcepub fn list_tables(&self) -> Result<Vec<String>>
pub fn list_tables(&self) -> Result<Vec<String>>
List all tables in the database
Sourcepub fn show_table_schema(&self, table_name: &str) -> Result<()>
pub fn show_table_schema(&self, table_name: &str) -> Result<()>
Show schema for a specific table
Sourcepub fn show_all_schemas(&self) -> Result<()>
pub fn show_all_schemas(&self) -> Result<()>
Show all table schemas
Sourcepub fn show_database_info(&self) -> Result<()>
pub fn show_database_info(&self) -> Result<()>
Show database information
Sourcepub fn export_to_csv(&self, table_name: &str, file_path: &str) -> Result<()>
pub fn export_to_csv(&self, table_name: &str, file_path: &str) -> Result<()>
Export a table to CSV
Sourcepub fn export_query_to_csv(&self, query: &str, file_path: &str) -> Result<()>
pub fn export_query_to_csv(&self, query: &str, file_path: &str) -> Result<()>
Export query results to CSV
Sourcepub fn start_repl(&self) -> Result<()>
pub fn start_repl(&self) -> Result<()>
Start the interactive REPL
Sourcepub fn start_shell(&self) -> Result<()>
pub fn start_shell(&self) -> Result<()>
Start the interactive shell
Sourcepub fn populate_with_test_data(
&self,
config: Option<PopulationConfig>,
) -> Result<()>
pub fn populate_with_test_data( &self, config: Option<PopulationConfig>, ) -> Result<()>
Populate database with test data
Sourcepub fn begin_transaction(&self) -> Result<()>
pub fn begin_transaction(&self) -> Result<()>
Begin a transaction
Sourcepub fn commit_transaction(&self) -> Result<()>
pub fn commit_transaction(&self) -> Result<()>
Commit the current transaction
Sourcepub fn rollback_transaction(&self) -> Result<()>
pub fn rollback_transaction(&self) -> Result<()>
Rollback the current transaction
Sourcepub fn is_transaction_active(&self) -> bool
pub fn is_transaction_active(&self) -> bool
Check if a transaction is active
Sourcepub fn bookmark_manager(&mut self) -> Option<&mut BookmarkManager>
pub fn bookmark_manager(&mut self) -> Option<&mut BookmarkManager>
Get access to the bookmark manager
Auto Trait Implementations§
impl !Freeze for VaporDB
impl !RefUnwindSafe for VaporDB
impl Send for VaporDB
impl !Sync for VaporDB
impl Unpin for VaporDB
impl !UnwindSafe for VaporDB
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