ZRange retrieves a specific range of elements from a sorted set (ZSet) denoted by a specific key. It returns a slice of ZSetValue containing the elements within the specified range (inclusive), and a nil error when successful. The order of the returned elements is based on their rank in the set, no
(key string, start int, end int)
| 752 | // |
| 753 | // This method is part of the ZSetStructure type. |
| 754 | func (zs *ZSetStructure) ZRange(key string, start int, end int) ([]ZSetValue, error) { |
| 755 | if err := checkKey(key); err != nil { |
| 756 | return nil, err |
| 757 | } |
| 758 | keyBytes := stringToBytesWithKey(key) |
| 759 | |
| 760 | zSet, err := zs.getZSetFromDB(keyBytes) |
| 761 | if err != nil { |
| 762 | return nil, err |
| 763 | } |
| 764 | r := zSet.skipList.getRange(start, end, false) |
| 765 | |
| 766 | // rank zero means no rank found |
| 767 | return r, nil |
| 768 | } |
| 769 | |
| 770 | // ZCount traverses through the elements of the ZSetStructure based on the given key. |
| 771 | // The count of elements between the range of min and max scores is determined. |
nothing calls this directly
no test coverage detected