Skip to content

feat: add support for GaussDB database type in CloudbeaverUsecase#569

Merged
winfredLIN merged 1 commit intomainfrom
feat-cb-gaussdb
Feb 12, 2026
Merged

feat: add support for GaussDB database type in CloudbeaverUsecase#569
winfredLIN merged 1 commit intomainfrom
feat-cb-gaussdb

Conversation

@BugsGuru
Copy link
Collaborator

@BugsGuru BugsGuru commented Feb 12, 2026

User description

关联的 issue

https://github.com/actiontech/sqle-ee/issues/2645

描述你的变更

  • dms cb工作台支持gaussdb

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc


Description

  • 添加 GaussDB 分支处理逻辑

  • 实现 fillGaussDBParams 方法设置 driverId

  • 更新解析函数以支持 GaussDB 类型

  • 新增 DBTypeGaussDB 常量定义


Diagram Walkthrough

flowchart LR
  A["Cloudbeaver业务逻辑"] -- "新增 GaussDB 分支" --> B["调用 fillGaussDBParams 配置参数"]
  C["常量定义文件"] -- "新增解析逻辑" --> D["新增 DBTypeGaussDB 常量"]
Loading

File Walkthrough

Relevant files
Enhancement
cloudbeaver.go
增加 GaussDB 逻辑和连接参数配置                                                                         

internal/dms/biz/cloudbeaver.go

  • 为 GaussDB 添加新的 case 分支
  • 实现 fillGaussDBParams 方法配置 driverId
+7/-0     
const.go
更新数据库类型解析与常量定义                                                                                     

internal/dms/pkg/constant/const.go

  • 在 ParseDBType 中新增 "GaussDB for MySQL" 分支
  • 添加 DBTypeGaussDB 常量定义
+4/-0     

- Implemented handling for GaussDB database type in GenerateCloudbeaverConnectionParams.
- Added a new method, fillGaussDBParams, to configure connection parameters specific to GaussDB.
- Updated constant definitions to include DBTypeGaussDB for improved database type management.
@github-actions
Copy link

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

注释缺失

建议为新增的 fillGaussDBParams 函数添加适当注释,以说明其功能和配置逻辑,提升代码可读性和维护性。

func (cu *CloudbeaverUsecase) fillGaussDBParams(config map[string]interface{}) error {
	config["driverId"] = "generic:gaussdb_jdbc"
	return nil
}
常量命名一致性

请检查 GaussDB 类型在解析逻辑和常量定义中的命名;确保 “GaussDB for MySQL” 与 “GaussDB / openGauss” 的命名策略一致,避免后续使用时出现混淆。

	case "GaussDB for MySQL":
		return DBTypeGaussDB, nil

	default:
		return "", fmt.Errorf("invalid db type: %s", s)
	}
}

const (
	DBTypeMySQL          DBType = "MySQL"
	DBTypePostgreSQL     DBType = "PostgreSQL"
	DBTypeTiDB           DBType = "TiDB"
	DBTypeSQLServer      DBType = "SQL Server"
	DBTypeOracle         DBType = "Oracle"
	DBTypeDB2            DBType = "DB2"
	DBTypeOceanBaseMySQL DBType = "OceanBase For MySQL"
	DBTypeTDSQLForInnoDB DBType = "TDSQL For InnoDB"
	DBTypeGoldenDB       DBType = "GoldenDB"
	DBTypeTBase          DBType = "TBase"
	DBTypeHive           DBType = "Hive"
	DBTypeDM             DBType = "达梦(DM)"
	DBTypeGaussDB        DBType = "GaussDB / openGauss"
)

@github-actions
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
增加空值检查

建议在使用 config 前先检查它是否为 nil,以防止在传入 nil 时发生 panic。这样可以增强代码的健壮性,防止由于空指针引发的运行时错误。

internal/dms/biz/cloudbeaver.go [1819-1822]

 func (cu *CloudbeaverUsecase) fillGaussDBParams(config map[string]interface{}) error {
+	if config == nil {
+		return fmt.Errorf("config 不能为空")
+	}
 	config["driverId"] = "generic:gaussdb_jdbc"
 	return nil
 }
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly adds a nil-check for config to prevent potential runtime panics, enhancing the function’s robustness in fillGaussDBParams. Its impact is moderate as it improves error handling without altering core logic.

Medium

@winfredLIN winfredLIN merged commit cf5e129 into main Feb 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants