Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A redis-cell Questions about strings #57

Open
Edelweiss-Snow opened this issue Jan 20, 2022 · 0 comments
Open

A redis-cell Questions about strings #57

Edelweiss-Snow opened this issue Jan 20, 2022 · 0 comments

Comments

@Edelweiss-Snow
Copy link

Edelweiss-Snow commented Jan 20, 2022

I have ran into a problem using redis-cell. As shown in the code, passing a string variable will throw an error of "Cell error: invalid digit found in string" but passing a string literal does the job.
To my knowledge, using a string variable should be the same as using a string literal. Is there any different interpretation in redis-cell or is there any difference in golang that causes this problem?
How can I use a string variable?
Thanks

func test() {
key := "example"
cli := redis.NewClient(&redis.Options{
Addr: "127.0.0.1:6379",
Password: "",
DB: 0,
})
_, err := cli.Ping().Result()
if err != nil {
return nil, fmt.Errorf("redis ping failed,err is:%s", err.Error())
}
_, err = control.redisCli.Do("cl.throttle", key, 89, 90, 10, 1).Result() //fail,this err is "Cell error: invalid digit found in string"
if err != nil {
return
}
_, err = control.redisCli.Do("cl.throttle", "111" + key, 89, 90, 10, 1).Result() // success
if err != nil {
return
}
_, err = control.redisCli.Do("cl.throttle", "example", 89, 90, 10, 1).Result() //success
if err != nil {
return
}
return
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant