From 816a5b028ccdc4ff04fd90985f3afdc95fea0609 Mon Sep 17 00:00:00 2001 From: actiontech-zihan Date: Thu, 21 May 2026 15:55:11 +0000 Subject: [PATCH 1/2] feat(driver): add DriverTypeOpenGauss constant for openGauss support (#2905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 driverV2.DriverTypeOpenGauss = "openGauss" 常量,用于 sqle-ee 主仓识别 openGauss 数据源类型。字面值首字母小写 o + G 大写,与 design §4.4 严格匹配契约 对齐;与即将在 code_review 阶段同步落地的 sqle CE 副本保持完全一致。 本 commit 仅修改常量定义,不做任何字符串归一化(lower/trim/EqualFold 等)。 配套单测见后续 commit。 --- sqle/driver/v2/util.go | 1 + 1 file changed, 1 insertion(+) diff --git a/sqle/driver/v2/util.go b/sqle/driver/v2/util.go index 7050321c6..d5841ff21 100644 --- a/sqle/driver/v2/util.go +++ b/sqle/driver/v2/util.go @@ -36,6 +36,7 @@ const ( DriverTypeTBase = "TBase" DriverTypeHANA = "HANA" DriverTypeGaussDB = "GaussDB" + DriverTypeOpenGauss = "openGauss" ) type DriverNotSupportedError struct { From 9c98b19e35426efe2a936530b659bc4c91d91f47 Mon Sep 17 00:00:00 2001 From: actiontech-zihan Date: Thu, 21 May 2026 15:55:25 +0000 Subject: [PATCH 2/2] test(driver): assert DriverTypeOpenGauss + DriverTypeGaussDB literal values (#2905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 sqle/driver/v2/util_test.go,map case 形态: - openGauss literal: DriverTypeOpenGauss == "openGauss" - GaussDB literal regression: DriverTypeGaussDB == "GaussDB" 字面值大小写敏感(!= 直接对比,不用 strings.EqualFold)。任何归一化都会让 本测试 fail,提示 code_review 同步落地的 sqle CE 副本必须保持完全一致。 --- sqle/driver/v2/util_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sqle/driver/v2/util_test.go diff --git a/sqle/driver/v2/util_test.go b/sqle/driver/v2/util_test.go new file mode 100644 index 000000000..a8c0cae54 --- /dev/null +++ b/sqle/driver/v2/util_test.go @@ -0,0 +1,28 @@ +package driverV2 + +import ( + "testing" +) + +// TestDriverTypeOpenGauss_Const_EE 断言 sqle-ee 副本中 DriverTypeOpenGauss 常量字面值 +// 严格为 "openGauss"(首字母小写 o,G 大写),并回归断言 DriverTypeGaussDB == "GaussDB", +// 保证两个 GaussDB / openGauss 字面值与 design §4.4 严格匹配契约一致。 +// +// 任何对该字面值的归一化(strings.ToLower / trim / 大小写改写)都会让本测试 fail, +// 提示 code_review 阶段同步落地的 sqle CE 副本必须保持完全一致。 +func TestDriverTypeOpenGauss_Const_EE(t *testing.T) { + cases := map[string]struct { + got string + want string + }{ + "openGauss literal": {got: DriverTypeOpenGauss, want: "openGauss"}, + "GaussDB literal regression": {got: DriverTypeGaussDB, want: "GaussDB"}, + } + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("constant literal drift: got %q, want %q", tc.got, tc.want) + } + }) + } +}