smzgl
cd6fd247e2
fix(database/gdb): fix iTableName interface detection when using WithAll with .Scan on reflect.Value objects (#4606)
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>
2026-01-15 21:23:07 +08:00
..
2021-09-23 19:29:20 +08:00
2025-03-06 23:04:26 +08:00
2025-09-18 16:21:02 +08:00
2024-12-01 23:47:51 +08:00
2022-03-21 21:17:48 +08:00
2024-03-24 21:18:30 +08:00
2025-08-28 16:53:19 +08:00
2024-06-25 21:11:36 +08:00
2025-09-01 15:33:50 +08:00
2025-08-28 16:53:19 +08:00
2025-12-08 11:18:45 +08:00
2025-12-09 15:46:41 +08:00
2025-12-12 15:14:21 +08:00
2022-09-26 22:11:13 +08:00
2025-12-09 15:46:41 +08:00
2022-09-26 22:11:13 +08:00
2026-01-15 21:23:07 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-12-12 15:14:21 +08:00
2025-11-21 17:27:09 +08:00
2025-09-28 17:57:27 +08:00
2025-12-12 15:14:21 +08:00
2023-11-20 20:47:26 +08:00
2026-01-15 13:27:25 +08:00
2022-11-01 20:12:21 +08:00
2025-12-26 16:43:19 +08:00
2025-12-26 16:43:19 +08:00
2024-12-09 23:12:20 +08:00
2025-12-12 15:14:21 +08:00
2024-12-07 14:01:31 +08:00
2025-12-12 15:14:21 +08:00
2026-01-15 10:25:40 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2023-09-04 21:23:46 +08:00
2022-02-16 00:26:06 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-29 10:32:30 +08:00
2025-09-28 17:08:37 +08:00
2025-09-18 16:21:02 +08:00
2025-09-18 16:21:02 +08:00
2025-08-22 15:29:16 +08:00
2025-03-06 23:04:26 +08:00
2025-12-08 11:18:45 +08:00