feat(database): 添加 ClickHouse 数据库驱动支持

- 实现了完整的 ClickHouse 驱动,包括连接、查询、插入、更新、删除等基本操作
- 添加了 ClickHouse 特有的数据类型转换和 SQL 过滤功能
- 实现了表结构查询和字段信息获取功能
- 添加了 Ping 检查和错误处理机制
- 增加了对 UPDATE 和 DELETE 语句的语法转换以适配 ClickHouse
- 添加了批量插入操作的支持
- 新增了 14 个测试用例文件用于验证数据库相关功能
This commit is contained in:
maguodong
2026-04-08 15:34:51 +08:00
parent 70ad831041
commit 398e732301
109 changed files with 5275 additions and 545 deletions
+4
View File
@@ -0,0 +1,4 @@
CREATE TABLE "public"."%s" (
"one" int8[] NOT NULL,
"two" text[][] NOT NULL
);
+4
View File
@@ -0,0 +1,4 @@
CREATE TABLE "public"."%s" (
"text" varchar(255) COLLATE "pg_catalog"."default",
"number" int4
);
+8
View File
@@ -0,0 +1,8 @@
CREATE TABLE "public"."%s"
(
"one" int8[] NOT NULL,
"two" text[][] NOT NULL,
"three" jsonb,
"four" json,
"five" jsonb
);
+5
View File
@@ -0,0 +1,5 @@
CREATE TABLE test_enum (
id int8 NOT NULL,
status int2 DEFAULT 0 NOT NULL,
CONSTRAINT test_enum_pk PRIMARY KEY (id)
);
+6
View File
@@ -0,0 +1,6 @@
DROP TABLE IF EXISTS instance;
CREATE TABLE instance (
f_id SERIAL NOT NULL PRIMARY KEY,
name varchar(255) DEFAULT ''
);
INSERT INTO instance VALUES (1, 'john');
@@ -0,0 +1,30 @@
CREATE TABLE table_a (
id SERIAL PRIMARY KEY,
alias varchar(255) DEFAULT ''
);
INSERT INTO table_a VALUES (1, 'table_a_test1');
INSERT INTO table_a VALUES (2, 'table_a_test2');
CREATE TABLE table_b (
id SERIAL PRIMARY KEY,
table_a_id integer NOT NULL,
alias varchar(255) DEFAULT ''
);
INSERT INTO table_b VALUES (10, 1, 'table_b_test1');
INSERT INTO table_b VALUES (20, 2, 'table_b_test2');
INSERT INTO table_b VALUES (30, 1, 'table_b_test3');
INSERT INTO table_b VALUES (40, 2, 'table_b_test4');
CREATE TABLE table_c (
id SERIAL PRIMARY KEY,
table_b_id integer NOT NULL,
alias varchar(255) DEFAULT ''
);
INSERT INTO table_c VALUES (100, 10, 'table_c_test1');
INSERT INTO table_c VALUES (200, 10, 'table_c_test2');
INSERT INTO table_c VALUES (300, 20, 'table_c_test3');
INSERT INTO table_c VALUES (400, 30, 'table_c_test4');
+4
View File
@@ -0,0 +1,4 @@
CREATE TABLE IF NOT EXISTS %s (
id SERIAL PRIMARY KEY,
name varchar(45) NOT NULL
);
@@ -0,0 +1,4 @@
CREATE TABLE IF NOT EXISTS %s (
uid SERIAL PRIMARY KEY,
address varchar(45) NOT NULL
);
@@ -0,0 +1,5 @@
CREATE TABLE IF NOT EXISTS %s (
id SERIAL PRIMARY KEY,
uid integer NOT NULL,
score integer NOT NULL
);