feat: add Tauri v2 Rust backend with PostgreSQL support
Add Rust backend: AppState with connection pool management, TuskError handling, ConnectionConfig model, and all commands for connections, schema browsing, query execution, data CRUD, and CSV/JSON export via sqlx. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
46
src-tauri/src/lib.rs
Normal file
46
src-tauri/src/lib.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
mod commands;
|
||||
mod error;
|
||||
mod models;
|
||||
mod state;
|
||||
|
||||
use state::AppState;
|
||||
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.manage(AppState::new())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
// connections
|
||||
commands::connections::get_connections,
|
||||
commands::connections::save_connection,
|
||||
commands::connections::delete_connection,
|
||||
commands::connections::test_connection,
|
||||
commands::connections::connect,
|
||||
commands::connections::switch_database,
|
||||
commands::connections::disconnect,
|
||||
// queries
|
||||
commands::queries::execute_query,
|
||||
// schema
|
||||
commands::schema::list_databases,
|
||||
commands::schema::list_schemas,
|
||||
commands::schema::list_tables,
|
||||
commands::schema::list_views,
|
||||
commands::schema::list_functions,
|
||||
commands::schema::list_indexes,
|
||||
commands::schema::list_sequences,
|
||||
commands::schema::get_table_columns,
|
||||
commands::schema::get_table_constraints,
|
||||
commands::schema::get_table_indexes,
|
||||
// data
|
||||
commands::data::get_table_data,
|
||||
commands::data::update_row,
|
||||
commands::data::insert_row,
|
||||
commands::data::delete_rows,
|
||||
// export
|
||||
commands::export::export_csv,
|
||||
commands::export::export_json,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
Reference in New Issue
Block a user