feat: add cross-database entity lookup for searching column values across all databases
Enables searching for a specific column value (e.g. carrier_id=123) across all databases on a PostgreSQL server. The backend creates temporary connection pools per database (semaphore-limited to 5), queries information_schema for matching columns, and executes read-only SELECTs with real-time progress events. Results are grouped by database/table in a new "Entity Lookup" tab. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
44
src-tauri/src/models/lookup.rs
Normal file
44
src-tauri/src/models/lookup.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LookupTableMatch {
|
||||
pub schema: String,
|
||||
pub table: String,
|
||||
pub column_type: String,
|
||||
pub columns: Vec<String>,
|
||||
pub types: Vec<String>,
|
||||
pub rows: Vec<Vec<serde_json::Value>>,
|
||||
pub row_count: usize,
|
||||
pub total_count: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LookupDatabaseResult {
|
||||
pub database: String,
|
||||
pub tables: Vec<LookupTableMatch>,
|
||||
pub error: Option<String>,
|
||||
pub search_time_ms: u128,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct EntityLookupResult {
|
||||
pub column_name: String,
|
||||
pub value: String,
|
||||
pub databases: Vec<LookupDatabaseResult>,
|
||||
pub total_databases_searched: usize,
|
||||
pub total_tables_matched: usize,
|
||||
pub total_rows_found: usize,
|
||||
pub total_time_ms: u128,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LookupProgress {
|
||||
pub lookup_id: String,
|
||||
pub database: String,
|
||||
pub status: String,
|
||||
pub tables_found: usize,
|
||||
pub rows_found: usize,
|
||||
pub error: Option<String>,
|
||||
pub completed: usize,
|
||||
pub total: usize,
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
pub mod ai;
|
||||
pub mod connection;
|
||||
pub mod history;
|
||||
pub mod lookup;
|
||||
pub mod management;
|
||||
pub mod query_result;
|
||||
pub mod saved_queries;
|
||||
|
||||
Reference in New Issue
Block a user