mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-12 06:29:40 +08:00
- MySQL/Redis/Oracle/PostgreSQL 内置可用,其余数据源改为“安装启用”后可用 - 新建连接对未安装驱动做弹窗内拦截提示,并支持一键跳转驱动管理安装 - 驱动管理展示安装包真实大小(从 Release 资产元数据读取)并优化加载性能 - Release 工作流发布各平台驱动代理资产,主程序构建启用 -s -w 精简
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package db
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
func mysqlAgentExecutableName() string {
|
|
return optionalDriverAgentExecutableName("mysql")
|
|
}
|
|
|
|
func optionalDriverAgentExecutableName(driverType string) string {
|
|
normalized := normalizeRuntimeDriverType(driverType)
|
|
if normalized == "" {
|
|
normalized = "unknown"
|
|
}
|
|
name := fmt.Sprintf("%s-driver-agent", normalized)
|
|
if runtime.GOOS == "windows" {
|
|
return name + ".exe"
|
|
}
|
|
return name
|
|
}
|
|
|
|
func ResolveOptionalDriverAgentExecutablePath(downloadDir string, driverType string) (string, error) {
|
|
normalized := normalizeRuntimeDriverType(driverType)
|
|
if strings.TrimSpace(normalized) == "" {
|
|
return "", fmt.Errorf("驱动类型为空")
|
|
}
|
|
root, err := resolveExternalDriverRoot(downloadDir)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return filepath.Join(root, normalized, optionalDriverAgentExecutableName(normalized)), nil
|
|
}
|
|
|
|
func ResolveMySQLAgentExecutablePath(downloadDir string) (string, error) {
|
|
return ResolveOptionalDriverAgentExecutablePath(downloadDir, "mysql")
|
|
}
|