Files
MyGoNavi/frontend/src/types.ts
Syngnat 49c7620bdd 🐛 fix(redis/kingbase): Redis数据库选择优化与金仓标识符引号修复
- Redis配置优化:移除固定数据库输入框,改为测试连接后多选数据库
  - 数据库筛选:支持选择显示的Redis数据库(0-15),留空显示全部
  - 类型扩展:SavedConnection新增includeRedisDatabases字段存储用户选择
  - 侧边栏过滤:根据配置过滤显示的Redis数据库列表
  - 金仓修复:KingBase/PostgreSQL标识符仅在必要时加双引号
  - 保留字检测:新增needsQuote函数识别特殊字符和SQL保留字
2026-02-04 17:00:51 +08:00

120 lines
2.1 KiB
TypeScript

export interface SSHConfig {
host: string;
port: number;
user: string;
password?: string;
keyPath?: string;
}
export interface ConnectionConfig {
type: string;
host: string;
port: number;
user: string;
password?: string;
database?: string;
useSSH?: boolean;
ssh?: SSHConfig;
redisDB?: number; // Redis database index (0-15)
}
export interface SavedConnection {
id: string;
name: string;
config: ConnectionConfig;
includeDatabases?: string[];
includeRedisDatabases?: number[]; // Redis databases to show (0-15)
}
export interface ColumnDefinition {
name: string;
type: string;
nullable: string;
key: string;
default?: string;
extra: string;
comment: string;
}
export interface IndexDefinition {
name: string;
columnName: string;
nonUnique: number;
seqInIndex: number;
indexType: string;
}
export interface ForeignKeyDefinition {
name: string;
columnName: string;
refTableName: string;
refColumnName: string;
constraintName: string;
}
export interface TriggerDefinition {
name: string;
timing: string;
event: string;
statement: string;
}
export interface TabData {
id: string;
title: string;
type: 'query' | 'table' | 'design' | 'redis-keys' | 'redis-command';
connectionId: string;
dbName?: string;
tableName?: string;
query?: string;
initialTab?: string;
readOnly?: boolean;
redisDB?: number; // Redis database index for redis tabs
}
export interface DatabaseNode {
title: string;
key: string;
isLeaf?: boolean;
children?: DatabaseNode[];
icon?: any;
}
export interface SavedQuery {
id: string;
name: string;
sql: string;
connectionId: string;
dbName: string;
createdAt: number;
}
// Redis types
export interface RedisKeyInfo {
key: string;
type: string;
ttl: number;
}
export interface RedisScanResult {
keys: RedisKeyInfo[];
cursor: number;
}
export interface RedisValue {
type: 'string' | 'hash' | 'list' | 'set' | 'zset';
ttl: number;
value: any;
length: number;
}
export interface RedisDBInfo {
index: number;
keys: number;
}
export interface ZSetMember {
member: string;
score: number;
}