Skip to content

Commit 988cbd6

Browse files
committed
rewrite interface{} to any
Signed-off-by: fukua95 <fukua95@gmail.com>
1 parent 03c2c0b commit 988cbd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1169
-1169
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ For example:
246246
"idx:bicycle",
247247
"@pickup_zone:[CONTAINS $bike]",
248248
&redis.FTSearchOptions{
249-
Params: map[string]interface{}{
249+
Params: map[string]any{
250250
"bike": "POINT(-0.1278 51.5074)",
251251
},
252252
DialectVersion: 3,

acl_commands.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package redis
33
import "context"
44

55
type ACLCmdable interface {
6-
ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd
6+
ACLDryRun(ctx context.Context, username string, command ...any) *StringCmd
77

88
ACLLog(ctx context.Context, count int64) *ACLLogCmd
99
ACLLogReset(ctx context.Context) *StatusCmd
@@ -20,8 +20,8 @@ type ACLCatArgs struct {
2020
Category string
2121
}
2222

23-
func (c cmdable) ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd {
24-
args := make([]interface{}, 0, 3+len(command))
23+
func (c cmdable) ACLDryRun(ctx context.Context, username string, command ...any) *StringCmd {
24+
args := make([]any, 0, 3+len(command))
2525
args = append(args, "acl", "dryrun", username)
2626
args = append(args, command...)
2727
cmd := NewStringCmd(ctx, args...)
@@ -30,7 +30,7 @@ func (c cmdable) ACLDryRun(ctx context.Context, username string, command ...inte
3030
}
3131

3232
func (c cmdable) ACLLog(ctx context.Context, count int64) *ACLLogCmd {
33-
args := make([]interface{}, 0, 3)
33+
args := make([]any, 0, 3)
3434
args = append(args, "acl", "log")
3535
if count > 0 {
3636
args = append(args, count)
@@ -53,7 +53,7 @@ func (c cmdable) ACLDelUser(ctx context.Context, username string) *IntCmd {
5353
}
5454

5555
func (c cmdable) ACLSetUser(ctx context.Context, username string, rules ...string) *StatusCmd {
56-
args := make([]interface{}, 3+len(rules))
56+
args := make([]any, 3+len(rules))
5757
args[0] = "acl"
5858
args[1] = "setuser"
5959
args[2] = username

acl_commands_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ var _ = Describe("ACL Categories", func() {
430430
"tdigest": "tdigest.rank",
431431
"timeseries": "ts.range",
432432
}
433-
var cats []interface{}
433+
var cats []any
434434

435435
for cat, subitem := range aclTestCase {
436436
cats = append(cats, cat)

bench_decode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func respString(b *testing.B, stub ClientStubFunc) {
219219

220220
func respArray(b *testing.B, stub ClientStubFunc) {
221221
rdb := stub([]byte("*3\r\n$5\r\nhello\r\n:10\r\n+OK\r\n"))
222-
var val []interface{}
222+
var val []any
223223

224224
b.ResetTimer()
225225
for i := 0; i < b.N; i++ {

bitmap_commands.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ type BitMapCmdable interface {
1515
BitOpNot(ctx context.Context, destKey string, key string) *IntCmd
1616
BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd
1717
BitPosSpan(ctx context.Context, key string, bit int8, start, end int64, span string) *IntCmd
18-
BitField(ctx context.Context, key string, values ...interface{}) *IntSliceCmd
19-
BitFieldRO(ctx context.Context, key string, values ...interface{}) *IntSliceCmd
18+
BitField(ctx context.Context, key string, values ...any) *IntSliceCmd
19+
BitFieldRO(ctx context.Context, key string, values ...any) *IntSliceCmd
2020
}
2121

2222
func (c cmdable) GetBit(ctx context.Context, key string, offset int64) *IntCmd {
@@ -66,7 +66,7 @@ func (c cmdable) BitCount(ctx context.Context, key string, bitCount *BitCount) *
6666
}
6767

6868
func (c cmdable) bitOp(ctx context.Context, op, destKey string, keys ...string) *IntCmd {
69-
args := make([]interface{}, 3+len(keys))
69+
args := make([]any, 3+len(keys))
7070
args[0] = "bitop"
7171
args[1] = op
7272
args[2] = destKey
@@ -97,7 +97,7 @@ func (c cmdable) BitOpNot(ctx context.Context, destKey string, key string) *IntC
9797
// BitPos is an API before Redis version 7.0, cmd: bitpos key bit start end
9898
// if you need the `byte | bit` parameter, please use `BitPosSpan`.
9999
func (c cmdable) BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd {
100-
args := make([]interface{}, 3+len(pos))
100+
args := make([]any, 3+len(pos))
101101
args[0] = "bitpos"
102102
args[1] = key
103103
args[2] = bit
@@ -131,9 +131,9 @@ func (c cmdable) BitPosSpan(ctx context.Context, key string, bit int8, start, en
131131
// BitField accepts multiple values:
132132
// - BitField("set", "i1", "offset1", "value1","cmd2", "type2", "offset2", "value2")
133133
// - BitField([]string{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})
134-
// - BitField([]interface{}{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})
135-
func (c cmdable) BitField(ctx context.Context, key string, values ...interface{}) *IntSliceCmd {
136-
args := make([]interface{}, 2, 2+len(values))
134+
// - BitField([]any{"cmd1", "type1", "offset1", "value1","cmd2", "type2", "offset2", "value2"})
135+
func (c cmdable) BitField(ctx context.Context, key string, values ...any) *IntSliceCmd {
136+
args := make([]any, 2, 2+len(values))
137137
args[0] = "bitfield"
138138
args[1] = key
139139
args = appendArgs(args, values)
@@ -145,8 +145,8 @@ func (c cmdable) BitField(ctx context.Context, key string, values ...interface{}
145145
// BitFieldRO - Read-only variant of the BITFIELD command.
146146
// It is like the original BITFIELD but only accepts GET subcommand and can safely be used in read-only replicas.
147147
// - BitFieldRO(ctx, key, "<Encoding0>", "<Offset0>", "<Encoding1>","<Offset1>")
148-
func (c cmdable) BitFieldRO(ctx context.Context, key string, values ...interface{}) *IntSliceCmd {
149-
args := make([]interface{}, 2, 2+len(values))
148+
func (c cmdable) BitFieldRO(ctx context.Context, key string, values ...any) *IntSliceCmd {
149+
args := make([]any, 2, 2+len(values))
150150
args[0] = "BITFIELD_RO"
151151
args[1] = key
152152
if len(values)%2 != 0 {

cluster_commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (c cmdable) ClusterCountKeysInSlot(ctx context.Context, slot int) *IntCmd {
127127
}
128128

129129
func (c cmdable) ClusterDelSlots(ctx context.Context, slots ...int) *StatusCmd {
130-
args := make([]interface{}, 2+len(slots))
130+
args := make([]any, 2+len(slots))
131131
args[0] = "cluster"
132132
args[1] = "delslots"
133133
for i, slot := range slots {
@@ -166,7 +166,7 @@ func (c cmdable) ClusterFailover(ctx context.Context) *StatusCmd {
166166
}
167167

168168
func (c cmdable) ClusterAddSlots(ctx context.Context, slots ...int) *StatusCmd {
169-
args := make([]interface{}, 2+len(slots))
169+
args := make([]any, 2+len(slots))
170170
args[0] = "cluster"
171171
args[1] = "addslots"
172172
for i, num := range slots {

0 commit comments

Comments
 (0)