mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Add SliceCmd.Scan() (hscan pkg) and tests
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8/internal"
|
||||
"github.com/go-redis/redis/v8/internal/hscan"
|
||||
"github.com/go-redis/redis/v8/internal/proto"
|
||||
"github.com/go-redis/redis/v8/internal/util"
|
||||
)
|
||||
@ -371,6 +372,13 @@ func (cmd *SliceCmd) String() string {
|
||||
return cmdString(cmd, cmd.val)
|
||||
}
|
||||
|
||||
// Scan scans the results from a key-value Redis map result set ([]interface{})
|
||||
// like HMGET and HGETALL to a destination struct.
|
||||
// The Redis keys are matched to the struct's field with the `redis` tag.
|
||||
func (cmd *SliceCmd) Scan(val interface{}) error {
|
||||
return hscan.Scan(cmd.val, val)
|
||||
}
|
||||
|
||||
func (cmd *SliceCmd) readReply(rd *proto.Reader) error {
|
||||
v, err := rd.ReadArrayReply(sliceParser)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user