mirror of https://github.com/go-gorm/gorm.git
check for pointer to pointer value (#5278)
* check for pointer to pointer value * revert to Ptr Co-authored-by: Alexei Melnic <alexei.melnic@meliora.xyz>
This commit is contained in:
parent
9b80fe9e96
commit
3643f856a3
|
@ -528,6 +528,9 @@ func (field *Field) setupValuerAndSetter() {
|
||||||
reflectValType := reflectV.Type()
|
reflectValType := reflectV.Type()
|
||||||
|
|
||||||
if reflectValType.AssignableTo(field.FieldType) {
|
if reflectValType.AssignableTo(field.FieldType) {
|
||||||
|
if reflectV.Kind() == reflect.Ptr && reflectV.Elem().Kind() == reflect.Ptr {
|
||||||
|
reflectV = reflect.Indirect(reflectV)
|
||||||
|
}
|
||||||
field.ReflectValueOf(ctx, value).Set(reflectV)
|
field.ReflectValueOf(ctx, value).Set(reflectV)
|
||||||
return
|
return
|
||||||
} else if reflectValType.ConvertibleTo(field.FieldType) {
|
} else if reflectValType.ConvertibleTo(field.FieldType) {
|
||||||
|
|
Loading…
Reference in New Issue