add redis Zrevrank (#137)
* update goctl rpc template log print url * add redis Zrevrank Co-authored-by: zhangkai <zhangkai@laoyuegou.com>
This commit is contained in:
@@ -73,6 +73,7 @@ type (
|
||||
ZrevrangebyscoreWithScores(key string, start, stop int64) ([]redis.Pair, error)
|
||||
ZrevrangebyscoreWithScoresAndLimit(key string, start, stop int64, page, size int) ([]redis.Pair, error)
|
||||
Zscore(key string, value string) (int64, error)
|
||||
Zrevrank(key, field string) (int64, error)
|
||||
}
|
||||
|
||||
clusterStore struct {
|
||||
@@ -644,6 +645,15 @@ func (cs clusterStore) Zscore(key string, value string) (int64, error) {
|
||||
return node.Zscore(key, value)
|
||||
}
|
||||
|
||||
func (cs clusterStore) Zrevrank(key, field string) (int64, error) {
|
||||
node, err := cs.getRedis(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return node.Zrevrank(key, field)
|
||||
}
|
||||
|
||||
func (cs clusterStore) getRedis(key string) (*redis.Redis, error) {
|
||||
if val, ok := cs.dispatcher.Get(key); !ok {
|
||||
return nil, ErrNoRedisNode
|
||||
|
||||
Reference in New Issue
Block a user