mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
feat(contrib/drivers/gaussdb): add gaussdb driver support (#4563)
This pull request introduces a new database driver for openGauss (GaussDB), integrating it into the GoFrame framework. The implementation includes connection handling, SQL execution, type conversion, and other driver-specific logic. Additionally, the CI workflow is updated to include an openGauss server for testing. The main themes are: new driver implementation, SQL and type handling, and CI integration. **GaussDB Driver Implementation:** * Added a new driver in `contrib/drivers/gaussdb` to support openGauss/GaussDB databases, including initialization, connection handling, and registration with GoFrame's database abstraction. (`gaussdb.go`, `gaussdb_open.go`) [[1]](diffhunk://#diff-4f0d2a9160a039ccdf1dc98205ed7cd9f3bb8d606fed57c5a4813937eecca81fL11-R49) [[2]](diffhunk://#diff-a0534a00c87159a3a3d2ea20a9779ead115cc7e38ab274484cfd4b2aa86b6055R1-R69) * Implemented custom SQL execution and result handling to support GaussDB's PostgreSQL-based features, including primary key handling on insert and custom result types. (`gaussdb_do_exec.go`, `gaussdb_result.go`) [[1]](diffhunk://#diff-528b2ec06651f4af022e0550526794a606bf257d59bc18b6bce58373c784a2f2R1-R110) [[2]](diffhunk://#diff-ad33dffe3bbccae20b113e3865aa491ef3b54c68ef586a89cf09a581a1c2abedR1-R24) **SQL and Type Handling:** * Added SQL filtering and placeholder conversion to support PostgreSQL-style parameterization and GaussDB-specific SQL quirks, such as handling `INSERT IGNORE` and JSONB syntax. (`gaussdb_do_filter.go`) * Implemented comprehensive type conversion logic for mapping PostgreSQL/GaussDB types to Go types, including arrays, UUIDs, and custom handling for JSON and numeric types. (`gaussdb_convert.go`) * Provided a function for random ordering (`ORDER BY RANDOM()`) and explicitly disabled upsert/ON CONFLICT support, as GaussDB does not support this feature. (`gaussdb_order.go`, `gaussdb_format_upsert.go`) [[1]](diffhunk://#diff-510fc9393899057fddacc7dd6d14f0ca2fff145b52341dd3cfa5db48c960e5c1R1-R12) [[2]](diffhunk://#diff-c89496520a15032be867e26861b248f11557cc45d683b5216ca1756949a7b9adR1-R94) **CI Integration:** * Updated the CI workflow to start an openGauss server in Docker, enabling automated tests against the new driver. (`.github/workflows/ci-main.yml`) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
11
.github/workflows/ci-main.yml
vendored
11
.github/workflows/ci-main.yml
vendored
@ -198,6 +198,17 @@ jobs:
|
||||
ports:
|
||||
- 5236:5236
|
||||
|
||||
# openGauss server
|
||||
# docker run --privileged=true -e GS_PASSWORD=UTpass@1234 -p 9950:5432 opengauss/opengauss:7.0.0-RC1.B023
|
||||
gaussdb:
|
||||
image: opengauss/opengauss:7.0.0-RC1.B023
|
||||
env:
|
||||
GS_PASSWORD: UTpass@1234
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- 9950:5432
|
||||
|
||||
|
||||
zookeeper:
|
||||
image: zookeeper:3.8
|
||||
ports:
|
||||
|
||||
Reference in New Issue
Block a user