Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test patch cluster support for scan operation #3178

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions generic_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import (
"context"
"time"

"github.com/redis/go-redis/v9/internal/hashtag"

Check failure on line 7 in generic_commands.go

View workflow job for this annotation

GitHub Actions / build (1.21.x, 7.4.2-54)

no required module provides package github.com/redis/go-redis/v9/internal/hashtag; to add it:

Check failure on line 7 in generic_commands.go

View workflow job for this annotation

GitHub Actions / build (1.19.x)

use of internal package github.com/redis/go-redis/v9/internal/hashtag not allowed

Check failure on line 7 in generic_commands.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

use of internal package github.com/redis/go-redis/v9/internal/hashtag not allowed
)

type GenericCmdable interface {
Expand Down Expand Up @@ -363,6 +365,9 @@
args = append(args, "count", count)
}
cmd := NewScanCmd(ctx, c, args...)
if hashtag.Present(match) {
cmd.SetFirstKeyPos(3)
}
_ = c(ctx, cmd)
return cmd
}
Expand Down
7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/redis/go-redis/v9
module github.com/ns-ofang/go-redis

go 1.18

Expand All @@ -8,8 +8,3 @@ require (
github.com/cespare/xxhash/v2 v2.2.0
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
)

retract (
v9.5.4 // This version was accidentally released. Please use version 9.6.0 instead.
v9.5.3 // This version was accidentally released. Please use version 9.6.0 instead.
)
12 changes: 12 additions & 0 deletions internal/hashtag/hashtag.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ func Key(key string) string {
return key
}

func Present(key string) bool {
if key == "" {
return false
}
if s := strings.IndexByte(key, '{'); s > -1 {
if e := strings.IndexByte(key[s+1:], '}'); e > 0 {
return true
}
}
return false
}

func RandomSlot() int {
return rand.Intn(slotNumber)
}
Expand Down
Loading