(minBuf []byte, maxBuf []byte)
| 44 | } |
| 45 | |
| 46 | func zparseScoreRange(minBuf []byte, maxBuf []byte) (min int64, max int64, err error) { |
| 47 | if strings.ToLower(hack.String(minBuf)) == "-inf" { |
| 48 | min = math.MinInt64 |
| 49 | } else { |
| 50 | |
| 51 | if len(minBuf) == 0 { |
| 52 | err = uhaha.ErrWrongNumArgs |
| 53 | return |
| 54 | } |
| 55 | |
| 56 | var lopen bool = false |
| 57 | if minBuf[0] == '(' { |
| 58 | lopen = true |
| 59 | minBuf = minBuf[1:] |
| 60 | } |
| 61 | |
| 62 | min, err = ledis.StrInt64(minBuf, nil) |
| 63 | if err != nil { |
| 64 | err = uhaha.ErrInvalid |
| 65 | return |
| 66 | } |
| 67 | |
| 68 | if min <= ledis.MinScore || min >= ledis.MaxScore { |
| 69 | err = uhaha.ErrWrongNumArgs |
| 70 | return |
| 71 | } |
| 72 | |
| 73 | if lopen { |
| 74 | min++ |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | if strings.ToLower(hack.String(maxBuf)) == "+inf" { |
| 79 | max = math.MaxInt64 |
| 80 | } else { |
| 81 | var ropen = false |
| 82 | |
| 83 | if len(maxBuf) == 0 { |
| 84 | err = uhaha.ErrWrongNumArgs |
| 85 | return |
| 86 | } |
| 87 | if maxBuf[0] == '(' { |
| 88 | ropen = true |
| 89 | maxBuf = maxBuf[1:] |
| 90 | } |
| 91 | |
| 92 | if maxBuf[0] == '(' { |
| 93 | ropen = true |
| 94 | maxBuf = maxBuf[1:] |
| 95 | } |
| 96 | |
| 97 | max, err = ledis.StrInt64(maxBuf, nil) |
| 98 | if err != nil { |
| 99 | err = uhaha.ErrWrongNumArgs |
| 100 | return |
| 101 | } |
| 102 | |
| 103 | if max <= ledis.MinScore || max >= ledis.MaxScore { |
no test coverage detected