mirror of https://github.com/go-gorm/gorm.git
Update field.go (#4228)
seems like the `if-else` branch do the same thing, so remove it
This commit is contained in:
parent
33601dc72f
commit
8cfa9d98f0
|
@ -441,15 +441,8 @@ func (field *Field) setupValuerAndSetter() {
|
||||||
// ReflectValueOf
|
// ReflectValueOf
|
||||||
switch {
|
switch {
|
||||||
case len(field.StructField.Index) == 1:
|
case len(field.StructField.Index) == 1:
|
||||||
if field.FieldType.Kind() == reflect.Ptr {
|
field.ReflectValueOf = func(value reflect.Value) reflect.Value {
|
||||||
field.ReflectValueOf = func(value reflect.Value) reflect.Value {
|
return reflect.Indirect(value).Field(field.StructField.Index[0])
|
||||||
fieldValue := reflect.Indirect(value).Field(field.StructField.Index[0])
|
|
||||||
return fieldValue
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
field.ReflectValueOf = func(value reflect.Value) reflect.Value {
|
|
||||||
return reflect.Indirect(value).Field(field.StructField.Index[0])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case len(field.StructField.Index) == 2 && field.StructField.Index[0] >= 0 && field.FieldType.Kind() != reflect.Ptr:
|
case len(field.StructField.Index) == 2 && field.StructField.Index[0] >= 0 && field.FieldType.Kind() != reflect.Ptr:
|
||||||
field.ReflectValueOf = func(value reflect.Value) reflect.Value {
|
field.ReflectValueOf = func(value reflect.Value) reflect.Value {
|
||||||
|
|
Loading…
Reference in New Issue