MCPcopy
hub / github.com/redis/go-redis / Scan

Method Scan

command.go:2167–2184  ·  view source on GitHub ↗

Scan scans the results from the map into a destination struct. The map keys are matched in the Redis struct fields by the `redis:"field"` tag.

(dest interface{})

Source from the content-addressed store, hash-verified

2165// Scan scans the results from the map into a destination struct. The map keys
2166// are matched in the Redis struct fields by the `redis:"field"` tag.
2167func (cmd *MapStringStringCmd) Scan(dest interface{}) error {
2168 if cmd.err != nil {
2169 return cmd.err
2170 }
2171
2172 strct, err := hscan.Struct(dest)
2173 if err != nil {
2174 return err
2175 }
2176
2177 for k, v := range cmd.val {
2178 if err := strct.Scan(k, v); err != nil {
2179 return err
2180 }
2181 }
2182
2183 return nil
2184}
2185
2186func (cmd *MapStringStringCmd) readReply(rd *proto.Reader) error {
2187 n, err := rd.ReadMapLen()

Callers

nothing calls this directly

Calls 2

StructFunction · 0.92
ScanMethod · 0.65

Tested by

no test coverage detected