fix preload on nil pointer
This commit is contained in:
parent
c3bb6aaa82
commit
35d9fc7a31
10
utils.go
10
utils.go
@ -266,11 +266,13 @@ func getValueFromFields(value reflect.Value, fieldNames []string) (results []int
|
|||||||
if indirectValue := reflect.Indirect(value); indirectValue.IsValid() {
|
if indirectValue := reflect.Indirect(value); indirectValue.IsValid() {
|
||||||
for _, fieldName := range fieldNames {
|
for _, fieldName := range fieldNames {
|
||||||
if fieldValue := indirectValue.FieldByName(fieldName); fieldValue.IsValid() {
|
if fieldValue := indirectValue.FieldByName(fieldName); fieldValue.IsValid() {
|
||||||
result := fieldValue.Interface()
|
if indirect(fieldValue).IsValid() {
|
||||||
if r, ok := result.(driver.Valuer); ok {
|
result := fieldValue.Interface()
|
||||||
result, _ = r.Value()
|
if r, ok := result.(driver.Valuer); ok {
|
||||||
|
result, _ = r.Value()
|
||||||
|
}
|
||||||
|
results = append(results, result)
|
||||||
}
|
}
|
||||||
results = append(results, result)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user