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

Method Scan

command.go:1028–1044  ·  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.

(dst interface{})

Source from the content-addressed store, hash-verified

1026// Scan scans the results from the map into a destination struct. The map keys
1027// are matched in the Redis struct fields by the `redis:"field"` tag.
1028func (cmd *SliceCmd) Scan(dst interface{}) error {
1029 if cmd.err != nil {
1030 return cmd.err
1031 }
1032
1033 // Pass the list of keys and values.
1034 // Skip the first two args for: HMGET key
1035 var args []interface{}
1036 if cmd.args[0] == "hmget" {
1037 args = cmd.args[2:]
1038 } else {
1039 // Otherwise, it's: MGET field field ...
1040 args = cmd.args[1:]
1041 }
1042
1043 return hscan.Scan(dst, args, cmd.val)
1044}
1045
1046func (cmd *SliceCmd) readReply(rd *proto.Reader) (err error) {
1047 cmd.val, err = rd.ReadSlice()

Callers

nothing calls this directly

Calls 1

ScanFunction · 0.92

Tested by

no test coverage detected