forked from mirror/gorm
Allow overwrite ignored field's permission, close #3829
This commit is contained in:
parent
61d3a4d6ea
commit
f655041908
|
@ -161,7 +161,7 @@ func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := schema.FieldsByName[field.Name]; !ok {
|
if of, ok := schema.FieldsByName[field.Name]; !ok || of.TagSettings["-"] == "-" {
|
||||||
schema.FieldsByName[field.Name] = field
|
schema.FieldsByName[field.Name] = field
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -576,7 +576,7 @@ func (stmt *Statement) SelectAndOmitColumns(requireCreate, requireUpdate bool) (
|
||||||
}
|
}
|
||||||
|
|
||||||
if stmt.Schema != nil {
|
if stmt.Schema != nil {
|
||||||
for _, field := range stmt.Schema.Fields {
|
for _, field := range stmt.Schema.FieldsByName {
|
||||||
name := field.DBName
|
name := field.DBName
|
||||||
if name == "" {
|
if name == "" {
|
||||||
name = field.Name
|
name = field.Name
|
||||||
|
|
Loading…
Reference in New Issue