API Reference
Complete reference for all Tauri backend commands.
API Reference
This page documents the complete list of remote procedure calls (RPC) available to the frontend via Tauri's invoke system.
Connection Commands
add_connection
Register a new database connection.
Stable
Inputs:
| Name | Type | Description |
|---|---|---|
name | String | Display name |
database_info | DatabaseInfo | Connection details |
color | number? | UI color hue |
Returns: Promise<ConnectionInfo>
await invoke('add_connection', { name, database_info, color })update_connection
Update an existing connection configuration.
Side Effect
May disconnect active session.
Inputs:
| Name | Type | Description |
|---|---|---|
conn_id | Uuid | Connection ID |
name | String | New name |
database_info | DatabaseInfo | New details |
color | number? | New color |
Returns: Promise<ConnectionInfo>
await invoke('update_connection', { conn_id, name, database_info, color })update_connection_color
Update only the color of a connection.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
color | number? | New color hue |
Returns: Promise<void>
await invoke('update_connection_color', { connection_id, color })connect_to_database
Establish an active connection.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
Returns: Promise<boolean>
await invoke('connect_to_database', { connection_id })disconnect_from_database
Close the active connection.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
Returns: Promise<void>
await invoke('disconnect_from_database', { connection_id })get_connections
List all configured connections.
Returns: Promise<ConnectionInfo[]>
const conns = await invoke('get_connections')remove_connection
Delete a connection configuration.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
Returns: Promise<void>
await invoke('remove_connection', { connection_id })test_connection
Test connectivity without saving.
Inputs:
| Name | Type | Description |
|---|---|---|
database_info | DatabaseInfo | Details to test |
Returns: Promise<boolean>
await invoke('test_connection', { database_info })initialize_connections
Loads and initializes connections from storage on startup.
Returns: Promise<void>
await invoke('initialize_connections')get_recent_connections
Get recently used connections.
Inputs:
| Name | Type | Description |
|---|---|---|
limit | number? | Max results |
Returns: Promise<ConnectionInfo[]>
await invoke('get_recent_connections', { limit: 5 })get_connection_history
Get historical connection attempts.
Inputs:
| Name | Type | Description |
|---|---|---|
db_type_filter | String? | Filter by DB type |
success_filter | boolean? | Filter by success |
limit | number? | Max results |
Returns: Promise<ConnectionHistoryEntry[]>
await invoke('get_connection_history', { limit: 20 })Query Commands
start_query
Execute a SQL query. Returns partial results immediately if possible or Query IDs.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Active connection |
query | String | SQL string |
Returns: Promise<number[]> (Query IDs)
await invoke('start_query', { connection_id, query })fetch_query
Get info about a query execution.
Inputs:
| Name | Type | Description |
|---|---|---|
query_id | number | Query ID |
Returns: Promise<StatementInfo>
await invoke('fetch_query', { query_id })fetch_page
Fetch a specific page of results.
Inputs:
| Name | Type | Description |
|---|---|---|
query_id | number | Query ID |
page_index | number | Page number |
Returns: Promise<Record<string, any>[] | null>
await invoke('fetch_page', { query_id, page_index: 0 })get_query_status
Check execution status.
Inputs:
| Name | Type | Description |
|---|---|---|
query_id | number | Query ID |
Returns: Promise<QueryStatus>
await invoke('get_query_status', { query_id })get_page_count
Get total pages for a query.
Inputs:
| Name | Type | Description |
|---|---|---|
query_id | number | Query ID |
Returns: Promise<number>
await invoke('get_page_count', { query_id })get_columns
Get column definitions for a query result.
Inputs:
| Name | Type | Description |
|---|---|---|
query_id | number | Query ID |
Returns: Promise<ColumnDef[] | null>
await invoke('get_columns', { query_id })save_query_to_history
Manually record a query execution.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | String | Connection ID |
query | String | SQL |
duration_ms | number? | Execution time |
status | String | Result status |
row_count | number | Rows affected |
error_message | String? | Error details |
Returns: Promise<void>
await invoke('save_query_to_history', { ... });get_query_history
Get history for a specific connection.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | String | Connection ID |
limit | number? | Max items |
Returns: Promise<QueryHistoryEntry[]>
await invoke('get_query_history', { connection_id })get_recent_queries
Get global query history.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | String? | Filter by connection |
limit | number? | Max items |
status_filter | String? | Filter by status |
Returns: Promise<QueryHistoryEntry[]>
await invoke('get_recent_queries', { limit: 50 })Script Commands
save_script
Save a SQL script.
Inputs:
| Name | Type | Description |
|---|---|---|
name | String | Script name |
content | String | SQL content |
connection_id | Uuid? | Linked connection |
description | String? | Metadata |
Returns: Promise<number> (Script ID)
const id = await invoke('save_script', { name, content })update_script
Update an existing script.
Inputs:
| Name | Type | Description |
|---|---|---|
id | number | Script ID |
name | String | New name |
content | String | New content |
connection_id | Uuid? | Linked connection |
description | String? | Description |
Returns: Promise<void>
await invoke('update_script', { id, name, content })get_scripts
List saved scripts.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid? | Filter by connection |
Returns: Promise<SavedQuery[]>
await invoke('get_scripts')delete_script
Delete a saved script.
Inputs:
| Name | Type | Description |
|---|---|---|
id | number | Script ID |
Returns: Promise<void>
await invoke('delete_script', { id })Setting / Session Commands
save_session_state
Persist UI session state (tabs, etc.).
Inputs:
| Name | Type | Description |
|---|---|---|
session_data | String | JSON string |
Returns: Promise<void>
await invoke('save_session_state', { session_data })get_session_state
Retrieve persisted session state.
Returns: Promise<String | null>
await invoke('get_session_state')get_setting
Get a user preference.
Inputs:
| Name | Type | Description |
|---|---|---|
key | String | Setting key |
Returns: Promise<String | null>
await invoke('get_setting', { key: 'theme' })set_setting
Set a user preference.
Inputs:
| Name | Type | Description |
|---|---|---|
key | String | Setting key |
value | String | Value |
Returns: Promise<void>
await invoke('set_setting', { key: 'theme', value: 'dark' })Mutation Commands
insert_row
Insert a record.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
table_name | String | Table |
schema_name | String? | Schema |
row_data | Object | Data |
Returns: Promise<MutationResult>
await invoke('insert_row', { connection_id, table_name, row_data })update_cell
Update a single cell value.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
table_name | String | Table |
schema_name | String? | Schema |
primary_key_column | String | PK Column |
primary_key_value | any | PK Value |
column_name | String | Target Column |
new_value | any | New Value |
Returns: Promise<MutationResult>
await invoke('update_cell', { ... });delete_rows
Delete rows by PK.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
table_name | String | Table |
schema_name | String? | Schema |
primary_key_column | String | PK Column |
primary_key_values | any[] | PK Values |
Returns: Promise<MutationResult>
await invoke('delete_rows', { ... });export_table
Export table data.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
table_name | String | Table |
schema_name | String? | Schema |
format | ExportFormat | Enum (CSV, JSON, SQL) |
limit | number? | Max rows |
Returns: Promise<String> (Data or Path)
await invoke('export_table', { ... });soft_delete_rows
Perform a soft delete (update flag).
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
table_name | String | Table |
schema_name | String? | Schema |
primary_key_column | String | PK Column |
primary_key_values | any[] | PK Values |
soft_delete_column | String? | Column to update |
Returns: Promise<SoftDeleteResult>
await invoke('soft_delete_rows', { ... });undo_soft_delete
Restore soft-deleted rows.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
table_name | String | Table |
schema_name | String? | Schema |
primary_key_column | String | PK Column |
primary_key_values | any[] | PK Values |
soft_delete_column | String | Column to restore |
Returns: Promise<MutationResult>
await invoke('undo_soft_delete', { ... });seed_table
Populate a table with mock data for testing. All seedable columns (non-PK) will be filled with realistic data based on their type and name.
Experimental
May fail on complex constraints.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
table_name | String | Target Table |
schema_name | String? | Target Schema |
count | number | Rows to insert |
Returns: Promise<SeedResult>
await invoke('seed_table', {
connection_id,
table_name: 'users',
count: 100
})truncate_table
Truncate a table.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
table_name | String | Table |
schema_name | String? | Schema |
cascade | boolean? | CASCADE option |
Returns: Promise<TruncateResult>
await invoke('truncate_table', { ... });truncate_database
Truncate ALL tables.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
schema_name | String? | Target schema (optional) |
confirm | boolean | Safety flag |
Returns: Promise<TruncateResult>
await invoke('truncate_database', { confirm: true, ... });dump_database
Create a database dump.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
output_path | String | Target file path |
Returns: Promise<DumpResult>
await invoke('dump_database', { output_path: '/tmp/dump.sql' })execute_batch
Execute multiple raw SQL statements.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
statements | String[] | SQL statements |
Returns: Promise<MutationResult>
await invoke('execute_batch', { statements: [...] });Metadata Commands
get_database_schema
Get full schema tree.
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
Returns: Promise<DatabaseSchema>
await invoke('get_database_schema', { connection_id })get_database_metadata
Get simple metadata (version, size).
Inputs:
| Name | Type | Description |
|---|---|---|
connection_id | Uuid | Connection ID |
Returns: Promise<DatabaseMetadata>
await invoke('get_database_metadata', { connection_id })