-
What is the recommended way to parse the output of TsRange()? For example, how to best parse: |
Beta Was this translation helpful? Give feedback.
Answered by
rueian
Sep 5, 2023
Replies: 1 comment
-
Hi @b1674927, According to the document, you can parse it like this: package main
import (
"context"
"github.com/redis/rueidis"
)
func main() {
client, err := rueidis.NewClient(rueidis.ClientOption{
InitAddress: []string{"127.0.0.1:6379"},
})
if err != nil {
panic(err)
}
defer client.Close()
cmd := client.B().TsRange().Key("myTsKey").Fromtimestamp("1693809900000").Totimestamp("1693896300000").Build()
pairs, err := client.Do(context.Background(), cmd).ToArray()
if err != nil {
panic(err)
}
for _, pair := range pairs {
p, _ := pair.ToArray()
timestamp, _ := p[0].AsInt64()
value, _ := p[1].ToString()
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
b1674927
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @b1674927,
According to the document, you can parse it like this: