Skip to content

Commit

Permalink
Merge pull request redis#1699 from openset/patch-1
Browse files Browse the repository at this point in the history
Add StringCmd.Bool()
  • Loading branch information
vmihailenco authored Mar 17, 2021
2 parents 7ba7ac4 + 785fa32 commit a3cd07d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a3cd07d

Please sign in to comment.