cmdINCR increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as an integer.
(m uhaha.Machine, args []string)
| 183 | // it is set to 0 before performing the operation. An error is returned if the key |
| 184 | // contains a value of the wrong type or contains a string that can not be represented |
| 185 | // as an integer. |
| 186 | func cmdINCR(m uhaha.Machine, args []string) (interface{}, error) { |
| 187 | // Check the number of arguments |
| 188 | if len(args) != 2 { |
| 189 | return nil, uhaha.ErrWrongNumArgs |
| 190 | } |
| 191 | |
| 192 | // Perform the Incr operation |
| 193 | n, err := ldb.Incr([]byte(args[1])) |
| 194 | if err != nil { |
| 195 | return nil, err |
| 196 | } |
| 197 | |
| 198 | // Return the new value after increment |
| 199 | return redcon.SimpleInt(n), nil |
| 200 | } |
| 201 | |
| 202 | // cmdGETSET sets the string value of a key and returns its old value. If the key does not exist, |
nothing calls this directly
no outgoing calls
no test coverage detected