10000 fix(genpbentity): enhance type mapping for database fields and add te… by fainc · Pull Request #4333 · gogf/gf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(genpbentity): enhance type mapping for database fields and add te… #4333

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

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

Conversation

fainc
Copy link
Contributor
@fainc fainc 8000 commented Jul 5, 2025

fix issue #4330

if lookGoodForYou { 
// todo
// 烦请修正文档:https://goframe.org/docs/cli/gen-pbentity#参数typemapping
// 参数typeMapping支持配置数据库字段类型对应的Go数据类型,默认值为:

decimal:
  type: float64
money:
  type: float64
numeric:
  type: float64
smallmoney:
  type: float64
}
  1. genpbentity 应该支持格式化的数据库类型至proto类型的直接转换,如:decimal 转换为 double;decimal 转换为 float64 如果要支持的话需要进行两重转换 decimal => float64 => double,目前不完善,变更的话破坏性也比较强。
  2. 这四类数据类型的处理按目前默认逻辑是转换为string,本次更新 仅支持手动定义typemapping,不变更默认值的处理以保持兼容性。

Ps.
请问最近有更新计划吗?
@gqcn @hailaz

@fainc fainc requested review from gqcn and hailaz July 5, 2025 08:35
@fainc
Copy link
Contributor Author
fainc commented Jul 5, 2025

这边 数据库 => go类型 => pb 类型 三层逻辑没有分离,目前提供一个兜底匹配补丁,实现decimal等被转换为string 通用类型的字段再匹配,已转为确定类型如 uint32 的则忽略,以免过多冗余判断。

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.

1 participant
0