Files
tusk/src/types/index.ts
A.Shakhmatov 3b3e225e8f feat: add connection colors, query history, SQL autocomplete, and EXPLAIN visualizer
Add four developer/QA features:
- Connection color coding: color picker in dialog, colored indicators across toolbar, tabs, status bar, and connection selectors
- Query history: Rust backend with JSON file storage (500 entry cap), sidebar panel with search/clear, auto-recording from workspace
- Schema-aware SQL autocomplete: backend fetches column metadata, CodeMirror receives schema namespace with public tables unprefixed
- EXPLAIN ANALYZE visualizer: recursive tree view with cost-colored bars, expand/collapse nodes, buffers info, Results/Explain tab toggle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 20:22:10 +03:00

111 lines
2.1 KiB
TypeScript

export interface ConnectionConfig {
id: string;
name: string;
host: string;
port: number;
user: string;
password: string;
database: string;
ssl_mode?: string;
color?: string;
}
export interface QueryResult {
columns: string[];
types: string[];
rows: unknown[][];
row_count: number;
execution_time_ms: number;
}
export interface PaginatedQueryResult extends QueryResult {
total_rows: number;
page: number;
page_size: number;
}
export interface SchemaObject {
name: string;
object_type: string;
schema: string;
}
export interface ColumnInfo {
name: string;
data_type: string;
is_nullable: boolean;
column_default: string | null;
ordinal_position: number;
character_maximum_length: number | null;
is_primary_key: boolean;
}
export interface ConstraintInfo {
name: string;
constraint_type: string;
columns: string[];
}
export interface IndexInfo {
name: string;
definition: string;
is_unique: boolean;
is_primary: boolean;
}
export interface HistoryEntry {
id: string;
connection_id: string;
connection_name: string;
database: string;
sql: string;
status: string;
error_message?: string;
row_count?: number;
execution_time_ms: number;
executed_at: string;
}
export interface ExplainNode {
"Node Type": string;
"Relation Name"?: string;
"Schema"?: string;
"Alias"?: string;
"Startup Cost": number;
"Total Cost": number;
"Plan Rows": number;
"Plan Width": number;
"Actual Startup Time"?: number;
"Actual Total Time"?: number;
"Actual Rows"?: number;
"Actual Loops"?: number;
"Shared Hit Blocks"?: number;
"Shared Read Blocks"?: number;
"Filter"?: string;
"Join Type"?: string;
"Index Name"?: string;
"Index Cond"?: string;
"Hash Cond"?: string;
"Sort Key"?: string[];
Plans?: ExplainNode[];
[key: string]: unknown;
}
export interface ExplainResult {
Plan: ExplainNode;
"Planning Time": number;
"Execution Time": number;
}
export type TabType = "query" | "table" | "structure";
export interface Tab {
id: string;
type: TabType;
title: string;
connectionId: string;
schema?: string;
table?: string;
sql?: string;
}