1
0
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:
Ilia Kuznetcov
2023-12-17 15:42:45 +00:00
committed by GitHub
parent 716906adda
commit c828764336
5 changed files with 14 additions and 22 deletions

View File

@@ -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