1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-12 14:21:52 +03:00

Remove Scanner in favor of ScanCmd.

This commit is contained in:
Vladimir Mihailenco
2017-01-03 12:44:06 +02:00
parent 67acf6e5a4
commit 10c56cede3
3 changed files with 44 additions and 58 deletions

View File

@ -71,10 +71,10 @@ type Cmdable interface {
SortInterfaces(key string, sort Sort) *SliceCmd
TTL(key string) *DurationCmd
Type(key string) *StatusCmd
Scan(cursor uint64, match string, count int64) Scanner
SScan(key string, cursor uint64, match string, count int64) Scanner
HScan(key string, cursor uint64, match string, count int64) Scanner
ZScan(key string, cursor uint64, match string, count int64) Scanner
Scan(cursor uint64, match string, count int64) *ScanCmd
SScan(key string, cursor uint64, match string, count int64) *ScanCmd
HScan(key string, cursor uint64, match string, count int64) *ScanCmd
ZScan(key string, cursor uint64, match string, count int64) *ScanCmd
Append(key, value string) *IntCmd
BitCount(key string, bitCount *BitCount) *IntCmd
BitOpAnd(destKey string, keys ...string) *IntCmd
@ -515,7 +515,7 @@ func (c *cmdable) Type(key string) *StatusCmd {
return cmd
}
func (c *cmdable) Scan(cursor uint64, match string, count int64) Scanner {
func (c *cmdable) Scan(cursor uint64, match string, count int64) *ScanCmd {
args := []interface{}{"scan", cursor}
if match != "" {
args = append(args, "match", match)
@ -523,15 +523,12 @@ func (c *cmdable) Scan(cursor uint64, match string, count int64) Scanner {
if count > 0 {
args = append(args, "count", count)
}
cmd := NewScanCmd(args...)
cmd := NewScanCmd(c.process, args...)
c.process(cmd)
return Scanner{
client: c,
ScanCmd: cmd,
}
return cmd
}
func (c *cmdable) SScan(key string, cursor uint64, match string, count int64) Scanner {
func (c *cmdable) SScan(key string, cursor uint64, match string, count int64) *ScanCmd {
args := []interface{}{"sscan", key, cursor}
if match != "" {
args = append(args, "match", match)
@ -539,15 +536,12 @@ func (c *cmdable) SScan(key string, cursor uint64, match string, count int64) Sc
if count > 0 {
args = append(args, "count", count)
}
cmd := NewScanCmd(args...)
cmd := NewScanCmd(c.process, args...)
c.process(cmd)
return Scanner{
client: c,
ScanCmd: cmd,
}
return cmd
}
func (c *cmdable) HScan(key string, cursor uint64, match string, count int64) Scanner {
func (c *cmdable) HScan(key string, cursor uint64, match string, count int64) *ScanCmd {
args := []interface{}{"hscan", key, cursor}
if match != "" {
args = append(args, "match", match)
@ -555,15 +549,12 @@ func (c *cmdable) HScan(key string, cursor uint64, match string, count int64) Sc
if count > 0 {
args = append(args, "count", count)
}
cmd := NewScanCmd(args...)
cmd := NewScanCmd(c.process, args...)
c.process(cmd)
return Scanner{
client: c,
ScanCmd: cmd,
}
return cmd
}
func (c *cmdable) ZScan(key string, cursor uint64, match string, count int64) Scanner {
func (c *cmdable) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd {
args := []interface{}{"zscan", key, cursor}
if match != "" {
args = append(args, "match", match)
@ -571,12 +562,9 @@ func (c *cmdable) ZScan(key string, cursor uint64, match string, count int64) Sc
if count > 0 {
args = append(args, "count", count)
}
cmd := NewScanCmd(args...)
cmd := NewScanCmd(c.process, args...)
c.process(cmd)
return Scanner{
client: c,
ScanCmd: cmd,
}
return cmd
}
//------------------------------------------------------------------------------