(m uhaha.Machine, args []string)
| 290 | } |
| 291 | |
| 292 | func cmdZADD(m uhaha.Machine, args []string) (interface{}, error) { |
| 293 | if len(args) < 3 { |
| 294 | return nil, uhaha.ErrWrongNumArgs |
| 295 | } |
| 296 | |
| 297 | ScorePair := make([]ledis.ScorePair, (len(args)-2)/2) |
| 298 | |
| 299 | index := 0 |
| 300 | for i := 2; i < len(args); i += 2 { |
| 301 | if score, err := strconv.Atoi(string(args[i])); err == nil { |
| 302 | ScorePair[index].Score = int64(score) |
| 303 | ScorePair[index].Member = []byte(args[i+1]) |
| 304 | index++ |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | n, err := ldb.ZAdd([]byte(args[1]), ScorePair...) |
| 309 | |
| 310 | if err != nil { |
| 311 | return nil, err |
| 312 | } |
| 313 | |
| 314 | return redcon.SimpleInt(n), nil |
| 315 | } |
| 316 | |
| 317 | func cmdZSCORE(m uhaha.Machine, args []string) (interface{}, error) { |
| 318 | if len(args) != 3 { |
nothing calls this directly
no outgoing calls
no test coverage detected