(m uhaha.Machine, args []string)
| 214 | |
| 215 | return redcon.SimpleString("OK"), nil |
| 216 | } |
| 217 | |
| 218 | func cmdHSETNX(m uhaha.Machine, args []string) (interface{}, error) { |
| 219 | if len(args) != 4 { |
| 220 | return nil, uhaha.ErrWrongNumArgs |
| 221 | } |
| 222 | |
| 223 | var n int64 = 1 |
| 224 | v, err := ldb.HGet([]byte(args[1]), []byte(args[2])) |
| 225 | if err != nil { |
| 226 | return nil, err |
| 227 | } |
| 228 | if v != nil { //Data exists, return zero |
| 229 | n = 0 |
| 230 | return redcon.SimpleInt(n), nil |
| 231 | } |
| 232 | |
| 233 | n, err = ldb.HSet([]byte(args[1]), []byte(args[2]), []byte(args[3])) |
| 234 | if err != nil { |
| 235 | return nil, err |
| 236 | } |
| 237 | |
| 238 | return n, nil |
| 239 | } |
| 240 |
nothing calls this directly
no outgoing calls
no test coverage detected