mirror of
https://gitee.com/johng/gf
synced 2026-06-29 02:26:29 +08:00
cd6fd247e2c9db57fe67feb78972170dacbe8f43
fix(gdb/getTableNameFromOrmTag): 修复在使用WithAll, 并且使用.Scan传入对象的情况下,
无法识别该对象字段是否实现了iTableName的接口. 因为该情况下, 传入的object是reflect.Value.
示例如下:
type MaterialDetail struct {
*entity.Material
SourceFile MaterialSourceFileDetail json:"source_file"
orm:"with:id=source_file_id"
}
type MaterialSourceFileDetail struct {
*entity.MaterialSourceFile
}
func (MaterialSourceFileDetail) TableName() string {
return dao.MaterialSourceFile.Table()
}
func foo(ctx context.Context) {
err = dao.Material.Ctx(ctx).WithAll().
Where(dao.Material.Columns().MaterialId, materialId).
Scan(&material)
}
这种情况下, 传入getTableNameFromOrmTag的object是reflect.Value, 而不是对象本身.
这会导致识别出MaterialSourceFileDetail已经实现了iTableName接口, 无法获取到正确的表名.
---------
Co-authored-by: hailaz <739476267@qq.com>
fix(database/gdb): fix iTableName interface detection when using WithAll with .Scan on reflect.Value objects (#4606)
refract(gerror): add ITextArgs interface and its implements, mainly for i18n that needs text and args separately (#4597)
fix(contrib/drivers): resolve field duplication issue when same table/column names exist across different MySQL/MariaDB databases (#4577)
English | 简体中文
A powerful framework for faster, easier, and more efficient project development.
Installation
go get -u github.com/gogf/gf/v2
Documentation
- Official Site: https://goframe.org
- Official Site(en): https://goframe.org/en
- 国内镜像: https://goframe.org.cn
- Mirror Site: Github Pages
- Mirror Site: Offline Docs
- GoDoc API: https://pkg.go.dev/github.com/gogf/gf/v2
- Doc Source: https://github.com/gogf/gf-site
Contributors
💖 Thanks to all the contributors who made GoFrame possible 💖
License
GoFrame is licensed under the MIT License, 100% free and open-source, forever.
Languages
GO
100%
