duplicated column with no tag assign IsIgnored struct
This commit is contained in:
parent
afef5813d8
commit
f4ece8aae9
@ -621,13 +621,20 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
|
|||||||
// look for field which has tag COLUMN assigned, if found any, set other fields which has the same DBName to IsIgnored = true
|
// look for field which has tag COLUMN assigned, if found any, set other fields which has the same DBName to IsIgnored = true
|
||||||
for _, v := range modelStruct.StructFields {
|
for _, v := range modelStruct.StructFields {
|
||||||
if column, ok := v.TagSettingsGet("COLUMN"); ok {
|
if column, ok := v.TagSettingsGet("COLUMN"); ok {
|
||||||
for _, field := range modelStruct.StructFields {
|
for k, field := range modelStruct.StructFields {
|
||||||
if field == v {
|
if field == v {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if field.DBName == column {
|
if field.DBName == column {
|
||||||
field.IsIgnored = true
|
ignoredField := &StructField{
|
||||||
field.IsNormal = false
|
Struct: field.Struct,
|
||||||
|
Name: field.Name,
|
||||||
|
Names: field.Names,
|
||||||
|
Tag: field.Tag,
|
||||||
|
TagSettings: field.TagSettings,
|
||||||
|
IsIgnored: true,
|
||||||
|
}
|
||||||
|
modelStruct.StructFields[k] = ignoredField
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user