cmdGETSET sets the string value of a key and returns its old value. If the key does not exist, it returns nil. An error is returned if the key contains a value of the wrong type.
(m uhaha.Machine, args []string)
| 201 | |
| 202 | // cmdGETSET sets the string value of a key and returns its old value. If the key does not exist, |
| 203 | // it returns nil. An error is returned if the key contains a value of the wrong type. |
| 204 | func cmdGETSET(m uhaha.Machine, args []string) (interface{}, error) { |
| 205 | // Check the number of arguments |
| 206 | if len(args) != 3 { |
| 207 | return nil, uhaha.ErrWrongNumArgs |
| 208 | } |
| 209 | |
| 210 | // Perform the GetSet operation |
| 211 | v, err := ldb.GetSet([]byte(args[1]), []byte(args[2])) |
| 212 | if err != nil { |
| 213 | return nil, err |
| 214 | } |
| 215 | |
| 216 | // Return the old value |
| 217 | return v, nil |
| 218 | } |
| 219 | |
| 220 | func cmdGETRANGE(m uhaha.Machine, args []string) (interface{}, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected