fix(09): WR-16 resolve model columns through embedded structs and explicit column tags
This commit is contained in:
@@ -245,10 +245,9 @@ func structFieldByColumn(model any, column string) (reflect.StructField, bool) {
|
||||
if t == nil || t.Kind() != reflect.Struct {
|
||||
return reflect.StructField{}, false
|
||||
}
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
field := t.Field(i)
|
||||
if field.PkgPath == "" && gormColumn(field) == column {
|
||||
return field, true
|
||||
for _, mf := range modelFields(t) {
|
||||
if gormColumn(mf.Field) == column {
|
||||
return mf.Field, true
|
||||
}
|
||||
}
|
||||
return reflect.StructField{}, false
|
||||
|
||||
Reference in New Issue
Block a user