Skip to content

feat(contrib/drivers/gaussdb): add gaussdb driver support#4563

Merged
gqcn merged 11 commits intomasterfrom
feat/gaussdb
Dec 16, 2025
Merged

feat(contrib/drivers/gaussdb): add gaussdb driver support#4563
gqcn merged 11 commits intomasterfrom
feat/gaussdb

Conversation

@gqcn
Copy link
Member

@gqcn gqcn commented Dec 13, 2025

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] [2]
  • 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] [2]

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] [2]

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)

Copilot AI review requested due to automatic review settings December 13, 2025 06:58
@gqcn gqcn requested review from LanceAdd and hailaz December 13, 2025 06:59
@gqcn gqcn changed the title feat(contrib/drivers/gaussdb): add gaussdb support feat(contrib/drivers/gaussdb): add gaussdb driver support Dec 13, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces comprehensive support for openGauss/GaussDB databases within the GoFrame ORM framework. The implementation includes a fully-featured driver with type conversion, SQL filtering, upsert operations, and CI integration for automated testing.

Key changes:

  • New GaussDB driver implementation with PostgreSQL-compatible connection handling and SQL execution
  • Comprehensive type conversion system supporting PostgreSQL/GaussDB-specific types including arrays, UUIDs, and JSONB
  • Custom MERGE-based upsert implementation to handle GaussDB's limitations with ON CONFLICT syntax

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
contrib/drivers/gaussdb/gaussdb.go Core driver registration and initialization
contrib/drivers/gaussdb/gaussdb_open.go Database connection string configuration and opening logic
contrib/drivers/gaussdb/gaussdb_do_exec.go Custom SQL execution with RETURNING clause for LastInsertId support
contrib/drivers/gaussdb/gaussdb_do_insert.go MERGE-based insert operations handling upsert and insert-ignore scenarios
contrib/drivers/gaussdb/gaussdb_do_filter.go SQL filtering for placeholder conversion and LIMIT/OFFSET syntax
contrib/drivers/gaussdb/gaussdb_convert.go Type conversion between PostgreSQL types and Go types
contrib/drivers/gaussdb/gaussdb_tables.go Table metadata retrieval with schema support
contrib/drivers/gaussdb/gaussdb_table_fields.go Field information retrieval with constraint detection
contrib/drivers/gaussdb/go.mod Dependency configuration for openGauss connector
contrib/drivers/gaussdb/gaussdb_z_unit_*.go Comprehensive test suite covering all driver features
.github/workflows/ci-main.yml CI workflow updated with openGauss Docker container

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gqcn and others added 3 commits December 13, 2025 15:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gqcn gqcn added the feature label Dec 13, 2025
@gqcn gqcn merged commit bf6238e into master Dec 16, 2025
20 checks passed
@gqcn gqcn deleted the feat/gaussdb branch December 16, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants