diff options
Diffstat (limited to 'pkg/commands/hgetall.go')
| -rw-r--r-- | pkg/commands/hgetall.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/commands/hgetall.go b/pkg/commands/hgetall.go new file mode 100644 index 0000000..02b3e3f --- /dev/null +++ b/pkg/commands/hgetall.go @@ -0,0 +1,20 @@ +package commands + +import ( + "errors" + "redisClone/pkg/core" +) + +func Hgetall(args []string, getShard func(k string) *core.Shard) interface{} { + key := args[1] + s := getShard(key) + item, exists := s.Data[key] + if !exists { + return nil + } + hash, ok := item.Value.(map[string]string) + if !ok { + return errors.New("WRONGTYPE Operation against a key holding the wrong kind of value") + } + return hash +} |
