Rolled back the behaviour of tag "embedded"
It's now required to use "embedded:fixed"
This commit is contained in:
parent
18616d53c4
commit
81ceeb3e9f
@ -1177,8 +1177,8 @@ db.Where("email = ?", "x@example.org").Attrs(User{RegisteredIp: "111.111.111.111
|
||||
```go
|
||||
type Delta struct {
|
||||
Id int;
|
||||
Was interface{} `gorm:"embedded"`;
|
||||
Became interface{} `gorm:"embedded"`;
|
||||
Was interface{} `gorm:"embedded:prefixed"`;
|
||||
Became interface{} `gorm:"embedded:prefixed"`;
|
||||
}
|
||||
|
||||
type Login struct {
|
||||
|
@ -299,10 +299,12 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
|
||||
field.IsNormal = true
|
||||
}
|
||||
case reflect.Struct:
|
||||
if _, ok := gormSettings["EMBEDDED"]; ok || fieldStruct.Anonymous {
|
||||
if embType, ok := gormSettings["EMBEDDED"]; ok || fieldStruct.Anonymous {
|
||||
for _, toField := range toScope.GetStructFields() {
|
||||
toField = toField.clone()
|
||||
if (embType == "prefixed") {
|
||||
toField.DBName = field.DBName+"__"+toField.DBName
|
||||
}
|
||||
toField.Names = append([]string{fieldStruct.Name}, toField.Names...)
|
||||
modelStruct.StructFields = append(modelStruct.StructFields, toField)
|
||||
if toField.IsPrimaryKey {
|
||||
|
Loading…
x
Reference in New Issue
Block a user