mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-07 19:11:39 +08:00
✨ feat(connection): 增强连接管理与交互体验
- 新增测试连接功能,修复底层驱动假成功问题,确保密码/端口验证准确 - 支持导入/导出连接配置(JSON),便于迁移与备份 - 优化侧边栏:实现虚拟滚动解决卡顿,增加数据库筛选与断开连接重连机制 - 优化交互:改进右键菜单体验(全行触发/禁用选文),完善新建查询的上下文自动关联 - 界面调整:精简连接弹窗,移除冗余的默认数据库输入
This commit is contained in:
@@ -28,7 +28,27 @@ func (a *App) DBConnect(config connection.ConnectionConfig) connection.QueryResu
|
||||
return connection.QueryResult{Success: false, Message: err.Error()}
|
||||
}
|
||||
|
||||
return connection.QueryResult{Success: true, Message: "Connected successfully"}
|
||||
return connection.QueryResult{Success: true, Message: "连接成功"}
|
||||
}
|
||||
|
||||
func (a *App) TestConnection(config connection.ConnectionConfig) connection.QueryResult {
|
||||
// Force close existing cached connection if any to ensure fresh test
|
||||
key := getCacheKey(config)
|
||||
func() {
|
||||
a.mu.Lock()
|
||||
defer a.mu.Unlock()
|
||||
if oldDB, ok := a.dbCache[key]; ok {
|
||||
oldDB.Close()
|
||||
delete(a.dbCache, key)
|
||||
}
|
||||
}()
|
||||
|
||||
_, err := a.getDatabase(config)
|
||||
if err != nil {
|
||||
return connection.QueryResult{Success: false, Message: err.Error()}
|
||||
}
|
||||
|
||||
return connection.QueryResult{Success: true, Message: "连接成功"}
|
||||
}
|
||||
|
||||
func (a *App) CreateDatabase(config connection.ConnectionConfig, dbName string) connection.QueryResult {
|
||||
|
||||
Reference in New Issue
Block a user