diff options
author | antirez <antirez@gmail.com> | 2018-09-27 11:43:48 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2018-09-27 11:44:25 +0200 |
commit | 80bde9844b7a88650bfd047dc913cc1da444e49c (patch) | |
tree | 4c92e9f877f225ce171ececb5f3f9d52cf8bd793 | |
parent | 7af83a0c11615d4c131ce0a81560450d7d7632c5 (diff) | |
download | redis-80bde9844b7a88650bfd047dc913cc1da444e49c.tar.gz |
Modules: Modules: dictionary API WIP #12: DictCompare API.
-rw-r--r-- | src/module.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/module.c b/src/module.c index 8295bd9b7..9c3d45f4c 100644 --- a/src/module.c +++ b/src/module.c @@ -4586,6 +4586,14 @@ int RM_DictCompareC(RedisModuleDictIter *di, const char *op, void *key, size_t k return res ? REDISMODULE_OK : REDISMODULE_ERR; } +/* Like RedisModule_DictCompareC but gets the key to compare with the current + * iterator key as a RedisModuleString. */ +int RM_DictCompare(RedisModuleDictIter *di, const char *op, RedisModuleString *key) { + if (raxEOF(&di->ri)) return REDISMODULE_ERR; + int res = raxCompare(&di->ri,op,key->ptr,sdslen(key->ptr)); + return res ? REDISMODULE_OK : REDISMODULE_ERR; +} + /* -------------------------------------------------------------------------- * Modules utility APIs * -------------------------------------------------------------------------- */ |