forked from mirror/gorm
Include ignored columns in Fields(), it could be used as cache field
This commit is contained in:
parent
5d0d2a8e98
commit
6c1ca7adb8
11
scope.go
11
scope.go
|
@ -414,11 +414,12 @@ func (scope *Scope) Fields(noRelations ...bool) map[string]*Field {
|
||||||
if field.IsPrimaryKey {
|
if field.IsPrimaryKey {
|
||||||
hasPrimaryKey = true
|
hasPrimaryKey = true
|
||||||
}
|
}
|
||||||
if field.IsIgnored {
|
if value, ok := fields[field.DBName]; ok {
|
||||||
continue
|
if value.IsIgnored {
|
||||||
}
|
fields[field.DBName] = field
|
||||||
if _, ok := fields[field.DBName]; ok {
|
} else if !value.IsIgnored {
|
||||||
panic(fmt.Sprintf("Duplicated column name for %v (%v)\n", scope.typeName(), fileWithLineNum()))
|
panic(fmt.Sprintf("Duplicated column name for %v (%v)\n", scope.typeName(), fileWithLineNum()))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fields[field.DBName] = field
|
fields[field.DBName] = field
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue