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,16 +441,9 @@ func (field *Field) setupValuerAndSetter() {
|
|||
// ReflectValueOf
|
||||
switch {
|
||||
case len(field.StructField.Index) == 1:
|
||||
if field.FieldType.Kind() == reflect.Ptr {
|
||||
field.ReflectValueOf = func(value reflect.Value) reflect.Value {
|
||||
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:
|
||||
field.ReflectValueOf = func(value reflect.Value) reflect.Value {
|
||||
return reflect.Indirect(value).Field(field.StructField.Index[0]).Field(field.StructField.Index[1])
|
||||
|
|
Loading…
Reference in New Issue