MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / ZRangeByRank

Method ZRangeByRank

sorted_set.go:163–180  ·  view source on GitHub ↗
(key string, start int, end int)

Source from the content-addressed store, hash-verified

161}
162
163func (z *SortedSet) ZRangeByRank(key string, start int, end int) ([]*core.Record, []float64, error) {
164 if sortedSet, ok := z.M[key]; ok {
165
166 nodes := sortedSet.GetByRankRange(start, end, false)
167
168 records := make([]*core.Record, len(nodes))
169 scores := make([]float64, len(nodes))
170
171 for i, node := range nodes {
172 records[i] = node.record
173 scores[i] = float64(node.score)
174 }
175
176 return records, scores, nil
177 }
178
179 return nil, nil, ErrSortedSetNotFound
180}
181
182func (z *SortedSet) ZRem(key string, value []byte) (*core.Record, error) {
183 if sortedSet, ok := z.M[key]; ok {

Callers

nothing calls this directly

Calls 1

GetByRankRangeMethod · 0.80

Tested by

no test coverage detected