valkey-io / valkey-go

A fast Golang Valkey client that supports Client Side Caching and Auto Pipelining.
Apache License 2.0
157 stars 10 forks source link

failed to parse xautoclaim result #16

Closed johnhaha closed 1 month ago

johnhaha commented 1 month ago

It seems unable to parse xautoclaim result.

XAUTOCLAIM mystream mygroup Alice 3600000 0-0 COUNT 25 1) "0-0" 2) 1) 1) "1609338752495-0" 2) 1) "field" 2) "value" 3) (empty array)

rueian commented 1 month ago

Try this:

arr, err := c.Do(context.Background(), c.B().Xautoclaim().Key("s").Group("g").Consumer("c").MinIdleTime("3600000").Start("0-0").Count(25).Build()).ToArray()
if err != nil {
    panic(err)
}
streamID, _ := arr[0].ToString()
entries, _ := arr[1].AsXRange()
johnhaha commented 1 month ago

this works, thx