Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

okyer
Copy link

@okyer okyer commented Nov 14, 2024

No description provided.

@@ -0,0 +1,54 @@
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
Copy link
Member

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.

@gqcn gqcn changed the title feat(contrib/drivers): add gaussdb driver feat(contrib/drivers/gaussdb): add gaussdb driver Nov 20, 2024
@gqcn gqcn changed the title feat(contrib/drivers/gaussdb): add gaussdb driver feat(contrib/drivers/gaussdb): add gaussdb driver support Nov 20, 2024
@houseme houseme requested a review from Copilot March 28, 2025 05:16
Copy link

@Copilot 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 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") {
Copy link
Preview

Copilot AI Mar 28, 2025

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.

Suggested change
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.

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.

2 participants