1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Add scan struct example (#1870)

This commit is contained in:
Vladimir Mihailenco
2021-08-29 19:37:17 +03:00
committed by GitHub
parent 989295a24b
commit ed42d3c37b
6 changed files with 166 additions and 6 deletions

View File

@ -39,12 +39,12 @@ func (s *structSpec) set(tag string, sf *structField) {
}
func newStructSpec(t reflect.Type, fieldTag string) *structSpec {
numField := t.NumField()
out := &structSpec{
m: make(map[string]*structField),
m: make(map[string]*structField, numField),
}
num := t.NumField()
for i := 0; i < num; i++ {
for i := 0; i < numField; i++ {
f := t.Field(i)
tag := f.Tag.Get(fieldTag)