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

Skip to content

Conversation

@FSpark
Copy link

@FSpark FSpark commented Mar 24, 2025

In Oracle databases, it is very common to use CHAR(1) fields with 'Y' or 'N' to represent boolean values. This PR adds support for interpreting 'Y' as true and 'N' as false to improve compatibility and developer experience.

Note:
Should we also consider adding support for 'T'/'F' as boolean equivalents? This pattern is also occasionally used in some legacy systems.

@gqcn
Copy link
Member

gqcn commented Mar 25, 2025

@FSpark Thanks for your contribution. It indeed needs such implement for recognizing boolean value for oracle, but we should not convert string Y/N to true/false globally in package gconv. It is advised using ConvertValueForField/CheckLocalTypeForField/ConvertValueForLocal implements for such scenario. You can add such implements referring to https://github.com/gogf/gf/blob/dfe088f5cd8c126dee6982a75360e1bb9f522200/contrib/drivers/pgsql/pgsql_convert.go .

@gqcn gqcn added the #πŸ‘ label Mar 25, 2025
@houseme houseme requested a review from Copilot March 28, 2025 05:13
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 adds support for converting Oracle CHAR(1) boolean representations into Go booleans, specifically enhancing compatibility with legacy database systems.

  • Adds a new mapping for "n" to be interpreted as false.
  • Supports automatic conversion of 'Y/N' strings, as indicated by the PR title.
Comments suppressed due to low confidence (1)

util/gconv/internal/converter/converter.go:51

  • The PR title suggests support for both 'Y' and 'N' strings, yet this diff only adds a mapping for 'n'. Consider adding or verifying the presence of a corresponding mapping for 'y' to maintain symmetric behavior.
"n":     {}

@gqcn
Copy link
Member

gqcn commented Dec 13, 2025

@FSpark You still updated the global converter. Such updates should be made in oracle implements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants