MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / ZRange

Method ZRange

structure/zset.go:754–768  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

752//
753// This method is part of the ZSetStructure type.
754func (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.

Callers

nothing calls this directly

Calls 4

getZSetFromDBMethod · 0.95
checkKeyFunction · 0.85
stringToBytesWithKeyFunction · 0.85
getRangeMethod · 0.80

Tested by

no test coverage detected