mirror of https://github.com/go-redis/redis.git
Add support for acl dryrun command (#2502)
* add support for acl dryrun command Co-authored-by: Monkey <golang@88.com>
This commit is contained in:
parent
984bc2810d
commit
386e0f0cd3
11
commands.go
11
commands.go
|
@ -452,6 +452,8 @@ type Cmdable interface {
|
||||||
GeoSearchStore(ctx context.Context, key, store string, q *GeoSearchStoreQuery) *IntCmd
|
GeoSearchStore(ctx context.Context, key, store string, q *GeoSearchStoreQuery) *IntCmd
|
||||||
GeoDist(ctx context.Context, key string, member1, member2, unit string) *FloatCmd
|
GeoDist(ctx context.Context, key string, member1, member2, unit string) *FloatCmd
|
||||||
GeoHash(ctx context.Context, key string, members ...string) *StringSliceCmd
|
GeoHash(ctx context.Context, key string, members ...string) *StringSliceCmd
|
||||||
|
|
||||||
|
ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatefulCmdable interface {
|
type StatefulCmdable interface {
|
||||||
|
@ -3757,3 +3759,12 @@ func (c cmdable) GeoPos(ctx context.Context, key string, members ...string) *Geo
|
||||||
_ = c(ctx, cmd)
|
_ = c(ctx, cmd)
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c cmdable) ACLDryRun(ctx context.Context, username string, command ...interface{}) *StringCmd {
|
||||||
|
args := make([]interface{}, 0, 3+len(command))
|
||||||
|
args = append(args, "acl", "dryrun", username)
|
||||||
|
args = append(args, command...)
|
||||||
|
cmd := NewStringCmd(ctx, args...)
|
||||||
|
_ = c(ctx, cmd)
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
|
@ -1874,6 +1874,12 @@ var _ = Describe("Commands", func() {
|
||||||
replace := client.Copy(ctx, "newKey", "key", redisOptions().DB, true)
|
replace := client.Copy(ctx, "newKey", "key", redisOptions().DB, true)
|
||||||
Expect(replace.Val()).To(Equal(int64(1)))
|
Expect(replace.Val()).To(Equal(int64(1)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should acl dryryn", func() {
|
||||||
|
dryRun := client.ACLDryRun(ctx, "default", "get", "randomKey")
|
||||||
|
Expect(dryRun.Err()).NotTo(HaveOccurred())
|
||||||
|
Expect(dryRun.Val()).To(Equal("OK"))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Describe("hashes", func() {
|
Describe("hashes", func() {
|
||||||
|
|
Loading…
Reference in New Issue