mirror of https://github.com/go-redis/redis.git
Merge pull request #218 from go-redis/fix/revert-api-change
Fix/revert api change
This commit is contained in:
commit
745d73395e
32
commands.go
32
commands.go
|
@ -767,11 +767,13 @@ func (c *commandable) LPop(key string) *StringCmd {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (c *commandable) LPush(key string, values ...interface{}) *IntCmd {
|
||||
args := make([]interface{}, 2, 2+len(values))
|
||||
func (c *commandable) LPush(key string, values ...string) *IntCmd {
|
||||
args := make([]interface{}, 2+len(values))
|
||||
args[0] = "LPUSH"
|
||||
args[1] = key
|
||||
args = append(args, values...)
|
||||
for i, value := range values {
|
||||
args[2+i] = value
|
||||
}
|
||||
cmd := NewIntCmd(args...)
|
||||
c.Process(cmd)
|
||||
return cmd
|
||||
|
@ -829,11 +831,13 @@ func (c *commandable) RPopLPush(source, destination string) *StringCmd {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (c *commandable) RPush(key string, values ...interface{}) *IntCmd {
|
||||
args := make([]interface{}, 2, 2+len(values))
|
||||
func (c *commandable) RPush(key string, values ...string) *IntCmd {
|
||||
args := make([]interface{}, 2+len(values))
|
||||
args[0] = "RPUSH"
|
||||
args[1] = key
|
||||
args = append(args, values...)
|
||||
for i, value := range values {
|
||||
args[2+i] = value
|
||||
}
|
||||
cmd := NewIntCmd(args...)
|
||||
c.Process(cmd)
|
||||
return cmd
|
||||
|
@ -847,11 +851,13 @@ func (c *commandable) RPushX(key string, value interface{}) *IntCmd {
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
func (c *commandable) SAdd(key string, members ...interface{}) *IntCmd {
|
||||
args := make([]interface{}, 2, 2+len(members))
|
||||
func (c *commandable) SAdd(key string, members ...string) *IntCmd {
|
||||
args := make([]interface{}, 2+len(members))
|
||||
args[0] = "SADD"
|
||||
args[1] = key
|
||||
args = append(args, members...)
|
||||
for i, member := range members {
|
||||
args[2+i] = member
|
||||
}
|
||||
cmd := NewIntCmd(args...)
|
||||
c.Process(cmd)
|
||||
return cmd
|
||||
|
@ -947,11 +953,13 @@ func (c *commandable) SRandMemberN(key string, count int64) *StringSliceCmd {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func (c *commandable) SRem(key string, members ...interface{}) *IntCmd {
|
||||
args := make([]interface{}, 2, 2+len(members))
|
||||
func (c *commandable) SRem(key string, members ...string) *IntCmd {
|
||||
args := make([]interface{}, 2+len(members))
|
||||
args[0] = "SREM"
|
||||
args[1] = key
|
||||
args = append(args, members...)
|
||||
for i, member := range members {
|
||||
args[2+i] = member
|
||||
}
|
||||
cmd := NewIntCmd(args...)
|
||||
c.Process(cmd)
|
||||
return cmd
|
||||
|
|
|
@ -1379,17 +1379,6 @@ var _ = Describe("Commands", func() {
|
|||
Expect(lRange.Val()).To(Equal([]string{"Hello", "World"}))
|
||||
})
|
||||
|
||||
It("should LPush bytes", func() {
|
||||
lPush := client.LPush("list", []byte("World"))
|
||||
Expect(lPush.Err()).NotTo(HaveOccurred())
|
||||
lPush = client.LPush("list", []byte("Hello"))
|
||||
Expect(lPush.Err()).NotTo(HaveOccurred())
|
||||
|
||||
lRange := client.LRange("list", 0, -1)
|
||||
Expect(lRange.Err()).NotTo(HaveOccurred())
|
||||
Expect(lRange.Val()).To(Equal([]string{"Hello", "World"}))
|
||||
})
|
||||
|
||||
It("should LPushX", func() {
|
||||
lPush := client.LPush("list", "World")
|
||||
Expect(lPush.Err()).NotTo(HaveOccurred())
|
||||
|
@ -1589,24 +1578,6 @@ var _ = Describe("Commands", func() {
|
|||
Expect(sMembers.Val()).To(ConsistOf([]string{"Hello", "World"}))
|
||||
})
|
||||
|
||||
It("should SAdd bytes", func() {
|
||||
sAdd := client.SAdd("set", []byte("Hello"))
|
||||
Expect(sAdd.Err()).NotTo(HaveOccurred())
|
||||
Expect(sAdd.Val()).To(Equal(int64(1)))
|
||||
|
||||
sAdd = client.SAdd("set", []byte("World"))
|
||||
Expect(sAdd.Err()).NotTo(HaveOccurred())
|
||||
Expect(sAdd.Val()).To(Equal(int64(1)))
|
||||
|
||||
sAdd = client.SAdd("set", []byte("World"))
|
||||
Expect(sAdd.Err()).NotTo(HaveOccurred())
|
||||
Expect(sAdd.Val()).To(Equal(int64(0)))
|
||||
|
||||
sMembers := client.SMembers("set")
|
||||
Expect(sMembers.Err()).NotTo(HaveOccurred())
|
||||
Expect(sMembers.Val()).To(ConsistOf([]string{"Hello", "World"}))
|
||||
})
|
||||
|
||||
It("should SCard", func() {
|
||||
sAdd := client.SAdd("set", "Hello")
|
||||
Expect(sAdd.Err()).NotTo(HaveOccurred())
|
||||
|
|
Loading…
Reference in New Issue