callValuerValue returns vr.Value(), with one exception: If vr.Value is an auto-generated method on a pointer type and the pointer is nil, it would panic at runtime in the panicwrap method. Treat it like nil instead. This is so people can implement driver.Value on value types and still use nil point
(vr driver.Valuer)
| 225 | // This is an exact copy of the same-named unexported function from the |
| 226 | // database/sql package. |
| 227 | func callValuerValue(vr driver.Valuer) (v driver.Value, err error) { |
| 228 | if rv := reflect.ValueOf(vr); rv.Kind() == reflect.Ptr && |
| 229 | rv.IsNil() && |
| 230 | rv.Type().Elem().Implements(valuerReflectType) { |
| 231 | return nil, nil |
| 232 | } |
| 233 | return vr.Value() |
| 234 | } |