Skip to content

Commit

Permalink
fix schema GetIdentityFieldValuesMap interface or ptr (go-gorm#6417)
Browse files Browse the repository at this point in the history
Co-authored-by: uptutu <[email protected]>
  • Loading branch information
uptutu and uptutu authored Aug 19, 2023
1 parent 2c20897 commit 7e44f73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions schema/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ func GetIdentityFieldValuesMap(ctx context.Context, reflectValue reflect.Value,
notZero, zero bool
)

if reflectValue.Kind() == reflect.Ptr ||
reflectValue.Kind() == reflect.Interface {
reflectValue = reflectValue.Elem()
}

switch reflectValue.Kind() {
case reflect.Struct:
results = [][]interface{}{make([]interface{}, len(fields))}
Expand Down

0 comments on commit 7e44f73

Please sign in to comment.