mirror of
https://github.com/redis/go-redis.git
synced 2025-06-12 14:21:52 +03:00
add support for slices in XAddArgs.Values
This commit is contained in:
@ -3413,18 +3413,20 @@ var _ = Describe("Commands", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(id).To(Equal("1-0"))
|
||||
|
||||
// Values supports []interface{}.
|
||||
id, err = client.XAdd(ctx, &redis.XAddArgs{
|
||||
Stream: "stream",
|
||||
ID: "2-0",
|
||||
Values: map[string]interface{}{"dos": "deux"},
|
||||
Values: []interface{}{"dos", "deux"},
|
||||
}).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(id).To(Equal("2-0"))
|
||||
|
||||
// Value supports []string.
|
||||
id, err = client.XAdd(ctx, &redis.XAddArgs{
|
||||
Stream: "stream",
|
||||
ID: "3-0",
|
||||
Values: map[string]interface{}{"tres": "troix"},
|
||||
Values: []string{"tres", "troix"},
|
||||
}).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(id).To(Equal("3-0"))
|
||||
|
Reference in New Issue
Block a user