-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(contrib/drivers/gaussdb): add gaussdb driver support #3925
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,54 @@ | |||
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@okyer Hello, I see the CI of this PR failed, as the docker service is missing for unit testing cases of gaussdb. You can add your gaussdb docker service in CI yaml here https://github.com/gogf/gf/blob/master/.github/workflows/ci-main.yml . You can refer to the existing docker service in CI yaml.
There was a problem hiding this 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 support for the GaussDB driver to the GoFrame framework. Key changes include adding driver implementation files (open, convert, do_exec, do_filter, do_insert, etc.), comprehensive unit tests covering CRUD operations and known issues, and helper functions for table management.
Reviewed Changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
gaussdb_z_unit_*.go (various) | Unit tests validating insert, update, delete, transaction, and issue-specific behaviors |
gaussdb_tables.go, gaussdb_table_fields.go | Functions for retrieving tables and table fields, adapting SQL queries for GaussDB |
gaussdb_open.go, gaussdb_do_insert.go, etc. | Core driver implementation files for handling SQL operations, filtering, conversions, and execution |
Files not reviewed (4)
- contrib/drivers/gaussdb/go.mod: Language not supported
- contrib/drivers/gaussdb/testdata/issues/issue3632.sql: Language not supported
- contrib/drivers/gaussdb/testdata/issues/issue3668.sql: Language not supported
- contrib/drivers/gaussdb/testdata/issues/issue3671.sql: Language not supported
Comments suppressed due to low confidence (1)
contrib/drivers/gaussdb/gaussdb_do_filter.go:39
- The regex replacement for the JSONB conversion may not cover all edge cases when multiple placeholders exist or when unexpected characters are present. Consider reviewing and adding tests to validate the correct handling of all JSONB scenarios.
return fmt.Sprintf(`::jsonb%s?`, match[2])
} | ||
affected := len(out.Records) | ||
if affected > 0 { | ||
if !strings.Contains(pkField.Type, "int") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relying on a substring check for 'int' to determine the primary key type may be too broad and might miss specific numeric types such as bigint. Consider refining the type check to explicitly handle supported numeric types.
if !strings.Contains(pkField.Type, "int") { | |
if pkField.Type != "int" && pkField.Type != "bigint" && pkField.Type != "smallint" { |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
No description provided.