You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
golden db 的查询兼容mysql, 是没有问题的,
但是goldendb对于不同的查询方式,返回的column有的是大写,有的是小写
导致不论struct里面column配置大写还是小写,都有一部分scan不到数据。
tx.Table(Table).Find(&hostApps) 返回大写
tx.Table(Table).Find(&hostApps).Where("xxx=?","xxx") 返回小写
我的想法是修改LookUpField的实现,兼容这种问题。
func (schema Schema) LookUpField(name string) *Field {
if field, ok := schema.FieldsByDBName[name]; ok {
return field
}
if field, ok := schema.FieldsByName[name]; ok {
return field
}
if field, ok := schema.FieldsByDBName[strings.ToLower(name)]; ok {
return field
}
if field, ok := schema.FieldsByName[strings.ToLower(name)]; ok {
return field
}
if field, ok := schema.FieldsByDBName[strings.ToUpper(name)]; ok {
return field
}
if field, ok := schema.FieldsByName[strings.ToUpper(name)]; ok {
return field
}
return nil
}
不知道有没有其他更好的解决方法。比如plugin的方式能重写这部分吗?
有的话,希望告知。
Motivation
Related Issues
The text was updated successfully, but these errors were encountered:
Describe the feature
golden db 的查询兼容mysql, 是没有问题的,
但是goldendb对于不同的查询方式,返回的column有的是大写,有的是小写
导致不论struct里面column配置大写还是小写,都有一部分scan不到数据。
tx.Table(Table).Find(&hostApps) 返回大写
tx.Table(Table).Find(&hostApps).Where("xxx=?","xxx") 返回小写
我的想法是修改LookUpField的实现,兼容这种问题。
不知道有没有其他更好的解决方法。比如plugin的方式能重写这部分吗?
有的话,希望告知。
Motivation
Related Issues
The text was updated successfully, but these errors were encountered: