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>
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
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,
|
|
}
|