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

feat: support eval_ro and evalsha_ro

Signed-off-by: tison <wander4096@gmail.com>
This commit is contained in:
tison
2022-09-24 11:28:14 +08:00
parent 4dcf3cca72
commit d56af1f2d1
4 changed files with 61 additions and 15 deletions

View File

@ -5413,6 +5413,29 @@ var _ = Describe("Commands", func() {
})
})
Describe("EvalRO", func() {
It("returns keys and values", func() {
vals, err := client.EvalRO(
ctx,
"return {KEYS[1],ARGV[1]}",
[]string{"key"},
"hello",
).Result()
Expect(err).NotTo(HaveOccurred())
Expect(vals).To(Equal([]interface{}{"key", "hello"}))
})
It("returns all values after an error", func() {
vals, err := client.EvalRO(
ctx,
`return {12, {err="error"}, "abc"}`,
nil,
).Result()
Expect(err).NotTo(HaveOccurred())
Expect(vals).To(Equal([]interface{}{int64(12), proto.RedisError("error"), "abc"}))
})
})
Describe("SlowLogGet", func() {
It("returns slow query result", func() {
const key = "slowlog-log-slower-than"