ScanStruct scans alternating names and values from src to a struct. The HGETALL and CONFIG GET commands return replies in this format.

ScanStruct uses exported field names to match values in the response. Use 'redis' field tag to override the name:

Field int `redis:"myName"`

Fields with the tag redis:"-" are ignored.

Integer, float, boolean, string and []byte fields are supported. Scan uses the standard strconv package to convert bulk string values to numeric and boolean types.

If a src element is nil, then the corresponding field is not modified.

ScanStruct is referenced in 55 repositories