1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Add *Map commands where possible.

This commit is contained in:
Vladimir Mihailenco
2013-02-02 14:17:01 +02:00
parent dfde8211d4
commit 5a90e32c63
4 changed files with 293 additions and 26 deletions

46
req.go
View File

@ -255,3 +255,49 @@ func (r *BoolSliceReq) Val() []bool {
}
return r.val.([]bool)
}
//------------------------------------------------------------------------------
type StringStringMapReq struct {
*BaseReq
}
func NewStringStringMapReq(args ...string) *StringStringMapReq {
return &StringStringMapReq{
BaseReq: NewBaseReq(args...),
}
}
func (r *StringStringMapReq) ParseReply(rd reader) (interface{}, error) {
return parseStringStringMapReply(rd)
}
func (r *StringStringMapReq) Val() map[string]string {
if r.val == nil {
return nil
}
return r.val.(map[string]string)
}
//------------------------------------------------------------------------------
type StringFloatMapReq struct {
*BaseReq
}
func NewStringFloatMapReq(args ...string) *StringFloatMapReq {
return &StringFloatMapReq{
BaseReq: NewBaseReq(args...),
}
}
func (r *StringFloatMapReq) ParseReply(rd reader) (interface{}, error) {
return parseStringFloatMapReply(rd)
}
func (r *StringFloatMapReq) Val() map[string]float64 {
if r.val == nil {
return nil
}
return r.val.(map[string]float64)
}