mirror of
https://github.com/redis/go-redis.git
synced 2025-08-08 23:42:06 +03:00
Allow scanning redis values into pointer fields (#2787)
* Allow scanning redis values into pointer fields * Formatting --------- Co-authored-by: Ilia Personal <iliapersonal@Ilyas-MBP.station> Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
This commit is contained in:
@@ -61,7 +61,11 @@ func newStructSpec(t reflect.Type, fieldTag string) *structSpec {
|
||||
}
|
||||
|
||||
// Use the built-in decoder.
|
||||
out.set(tag, &structField{index: i, fn: decoders[f.Type.Kind()]})
|
||||
kind := f.Type.Kind()
|
||||
if kind == reflect.Pointer {
|
||||
kind = f.Type.Elem().Kind()
|
||||
}
|
||||
out.set(tag, &structField{index: i, fn: decoders[kind]})
|
||||
}
|
||||
|
||||
return out
|
||||
|
Reference in New Issue
Block a user