Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(contrib/drivers): more database drivers#4553

Merged
gqcn merged 37 commits intomasterfrom
feat/gdb-types
Dec 9, 2025
Merged

feat(contrib/drivers): more database drivers#4553
gqcn merged 37 commits intomasterfrom
feat/gdb-types

Conversation

@gqcn
Copy link
Member

@gqcn gqcn commented Dec 9, 2025

This pull request adds first-class support for MariaDB, TiDB, OceanBase, and GaussDB as separate database drivers in the GoFrame ecosystem, rather than relying solely on MySQL compatibility. It introduces new driver packages for each database, updates documentation to reflect these additions, and adjusts dependency management files accordingly. The changes also deprecate the MariaDB-specific logic in the MySQL driver in favor of the new dedicated MariaDB driver.

New Database Driver Support

  • Added new driver packages for MariaDB, TiDB, OceanBase, and GaussDB under contrib/drivers/, each with their own Go module files and driver implementation that wraps the MySQL driver for protocol compatibility and future extensibility. [1] [2] [3] [4] [5] [6] [7]
  • Registered these new drivers in the main module's go.mod and go.work files for proper dependency resolution and local development. [1] [2]

Documentation Updates

  • Expanded the contrib/drivers/README.MD to include installation and import instructions for the new drivers, and clarified the supported drivers section with dedicated code examples for each. [1] [2]

MariaDB Driver Enhancements

  • Implemented a MariaDB-specific TableFields method and SQL query in the new driver, improving the accuracy of table field retrieval for MariaDB databases.
  • Added unit test initialization code for MariaDB to ensure driver functionality.

Deprecation and Refactoring

  • Marked the MariaDB-specific logic and SQL in the MySQL driver as deprecated, with a note to remove it in the next version, directing users to the new MariaDB driver instead. [1] [2]

gqcn and others added 30 commits December 4, 2025 17:29
…ey acquisition logic (#4546)

`pgsql driver`中`getPrimaryKeys`未使用现有缓存,导致每次`insert`都会重新查询表字段
`gf gen
dao`生成`entity`时支持数据库`uuid`类型字段生成`github.com/google/uuid`的`uuid.UUID`类型字段
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 pull request adds first-class support for MariaDB, TiDB, OceanBase, and GaussDB as separate database drivers in the GoFrame ecosystem. Previously, these databases were handled through the MySQL driver based on protocol compatibility. The PR introduces dedicated driver packages for each database to allow for future extensibility and database-specific features.

Key Changes:

  • Added new driver packages for MariaDB, TiDB, OceanBase, and GaussDB under contrib/drivers/
  • Implemented MariaDB-specific TableFields method to improve field retrieval accuracy
  • Deprecated MariaDB-specific logic in the MySQL driver
  • Updated documentation to reflect the new separate drivers

Critical Issue Identified:
The most significant issue is that the MySQL driver (contrib/drivers/mysql/mysql.go) still registers "mariadb" and "tidb" as driver names in its init function (line 30), which will conflict with the new dedicated drivers that also attempt to register these same names. This needs to be fixed before merging.

Reviewed changes

Copilot reviewed 15 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
contrib/drivers/tidb/tidb.go New TiDB driver implementation wrapping MySQL driver
contrib/drivers/tidb/go.mod Module definition for TiDB driver
contrib/drivers/tidb/go.sum Dependencies for TiDB driver
contrib/drivers/oceanbase/oceanbase.go New OceanBase driver implementation wrapping MySQL driver
contrib/drivers/oceanbase/go.mod Module definition for OceanBase driver
contrib/drivers/oceanbase/go.sum Dependencies for OceanBase driver
contrib/drivers/gaussdb/gaussdb.go New GaussDB driver implementation wrapping MySQL driver
contrib/drivers/gaussdb/go.mod Module definition for GaussDB driver
contrib/drivers/gaussdb/go.sum Dependencies for GaussDB driver
contrib/drivers/mariadb/mariadb.go New MariaDB driver implementation wrapping MySQL driver
contrib/drivers/mariadb/mariadb_table_fields.go MariaDB-specific TableFields implementation with custom SQL query
contrib/drivers/mariadb/mariadb_unit_init_test.go Test initialization code for MariaDB driver
contrib/drivers/mariadb/mariadb_unit_model_test.go Comprehensive test suite for MariaDB driver functionality
contrib/drivers/mariadb/go.mod Module definition for MariaDB driver
contrib/drivers/mariadb/go.sum Dependencies for MariaDB driver
contrib/drivers/mysql/mysql_table_fields.go Added deprecation notices for MariaDB-specific code
contrib/drivers/mysql/mysql_z_unit_init_test.go Minor comment formatting fix
contrib/drivers/README.MD Updated with separate sections for new drivers and installation instructions
cmd/gf/go.mod Added dependencies for new drivers
cmd/gf/go.work Added replace directives for new drivers

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

@gqcn gqcn merged commit 5cbe421 into master Dec 9, 2025
20 checks passed
@gqcn gqcn deleted the feat/gdb-types branch December 9, 2025 08:33
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.

3 participants