mirror of https://github.com/go-gorm/gorm.git
Fix get PrimaryKeyField with embedded struct
This commit is contained in:
parent
aac52fdcf8
commit
87b23edd3b
2
scope.go
2
scope.go
|
@ -107,7 +107,7 @@ func (scope *Scope) PrimaryKeyField() *Field {
|
||||||
if typ.Kind() == reflect.Ptr {
|
if typ.Kind() == reflect.Ptr {
|
||||||
typ = typ.Elem()
|
typ = typ.Elem()
|
||||||
}
|
}
|
||||||
clone = scope.New(reflect.New(typ).Elem().Interface())
|
clone = scope.New(reflect.New(typ).Elem().Addr().Interface())
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, field := range clone.Fields() {
|
for _, field := range clone.Fields() {
|
||||||
|
|
Loading…
Reference in New Issue