On success retrieve the double score associated at the sorted set element * 'ele' and returns REDISMODULE_OK. Otherwise REDISMODULE_ERR is returned * to signal one of the following conditions: * * * There is no such element 'ele' in the sorted set. * * The key is not a sorted set. * * The key is an open empty key. */
| 2818 | * * The key is an open empty key. |
| 2819 | */ |
| 2820 | int RM_ZsetScore(RedisModuleKey *key, RedisModuleString *ele, double *score) { |
| 2821 | if (key->value == NULL) return REDISMODULE_ERR; |
| 2822 | if (key->value->type != OBJ_ZSET) return REDISMODULE_ERR; |
| 2823 | if (zsetScore(key->value,szFromObj(ele),score) == C_ERR) return REDISMODULE_ERR; |
| 2824 | return REDISMODULE_OK; |
| 2825 | } |
| 2826 | |
| 2827 | /* -------------------------------------------------------------------------- |
| 2828 | * ## Key API for Sorted Set iterator |