MCPcopy Create free account
hub / github.com/dbProjectRED/redimo.go / zRange

Method zRange

sorted_sets.go:267–282  ·  view source on GitHub ↗
(key string, start int64, stop int64, forward bool)

Source from the content-addressed store, hash-verified

265}
266
267func (c Client) zRange(key string, start int64, stop int64, forward bool) (membersWithScores map[string]float64, err error) {
268 if start < 0 && stop < 0 {
269 return c.zGeneralRange(key, negInf, posInf, -stop-1, -start, !forward, c.skN)
270 }
271
272 if start > 0 && stop < 0 {
273 lastScore, err := c.zGeneralRange(key, negInf, posInf, -stop-1, 1, !forward, c.skN)
274 if err != nil {
275 return membersWithScores, err
276 }
277
278 return c.zGeneralRange(key, negInf, zScore{floatValues(lastScore)[0]}, start, 0, forward, c.skN)
279 }
280
281 return c.zGeneralRange(key, negInf, posInf, start, stop-start+1, forward, c.skN)
282}
283
284func floatValues(floatValuedMap map[string]float64) (values []float64) {
285 for _, v := range floatValuedMap {

Callers 2

ZRANGEMethod · 0.95
ZREVRANGEMethod · 0.95

Calls 2

zGeneralRangeMethod · 0.95
floatValuesFunction · 0.85

Tested by

no test coverage detected