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

Merge pull request #1699 from openset/patch-1

Add StringCmd.Bool()
This commit is contained in:
Vladimir Mihailenco
2021-03-17 13:39:13 +02:00
committed by GitHub

View File

@ -710,6 +710,13 @@ func (cmd *StringCmd) Bytes() ([]byte, error) {
return util.StringToBytes(cmd.val), cmd.err
}
func (cmd *StringCmd) Bool() (bool, error) {
if cmd.err != nil {
return false, cmd.err
}
return strconv.ParseBool(cmd.val)
}
func (cmd *StringCmd) Int() (int, error) {
if cmd.err != nil {
return 0, cmd.err