1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-22 10:01:50 +03:00

Add support for scripting commands.

This commit is contained in:
Vladimir Mihailenco
2012-08-20 13:42:33 +03:00
parent 303687e438
commit 9ad848d04b
6 changed files with 231 additions and 33 deletions

47
req.go
View File

@ -66,6 +66,22 @@ func (r *BaseReq) ParseReply(rd reader) (interface{}, error) {
//------------------------------------------------------------------------------
type IfaceReq struct {
*BaseReq
}
func NewIfaceReq(args ...string) *IfaceReq {
return &IfaceReq{
BaseReq: NewBaseReq(args...),
}
}
func (r *IfaceReq) Val() interface{} {
return r.val
}
//------------------------------------------------------------------------------
type StatusReq struct {
*BaseReq
}
@ -187,10 +203,6 @@ func NewIfaceSliceReq(args ...string) *IfaceSliceReq {
}
}
func (r *IfaceSliceReq) ParseReply(rd reader) (interface{}, error) {
return parseIfaceSliceReply(rd)
}
func (r *IfaceSliceReq) Val() []interface{} {
if r.val == nil {
return nil
@ -210,9 +222,36 @@ func NewStringSliceReq(args ...string) *StringSliceReq {
}
}
func (r *StringSliceReq) ParseReply(rd reader) (interface{}, error) {
return parseStringSliceReply(rd)
}
func (r *StringSliceReq) Val() []string {
if r.val == nil {
return nil
}
return r.val.([]string)
}
//------------------------------------------------------------------------------
type BoolSliceReq struct {
*BaseReq
}
func NewBoolSliceReq(args ...string) *BoolSliceReq {
return &BoolSliceReq{
BaseReq: NewBaseReq(args...),
}
}
func (r *BoolSliceReq) ParseReply(rd reader) (interface{}, error) {
return parseBoolSliceReply(rd)
}
func (r *BoolSliceReq) Val() []bool {
if r.val == nil {
return nil
}
return r.val.([]bool)
}