diff --git a/includes/cpp_redis/future_client.hpp b/includes/cpp_redis/future_client.hpp index 8dbc41ef..aa9aa282 100644 --- a/includes/cpp_redis/future_client.hpp +++ b/includes/cpp_redis/future_client.hpp @@ -791,18 +791,50 @@ class future_client { return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zcount(key, min, max, cb); }); } future + zcount(const std::string& key, double min, double max) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zcount(key, min, max, cb); }); + } + future + zcount(const std::string& key, const std::string& min, const std::string& max) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zcount(key, min, max, cb); }); + } + future zincrby(const std::string& key, int incr, const std::string& member) { return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zincrby(key, incr, member, cb); }); } + future + zincrby(const std::string& key, double incr, const std::string& member) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zincrby(key, incr, member, cb); }); + } + future + zincrby(const std::string& key, const std::string& incr, const std::string& member) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zincrby(key, incr, member, cb); }); + } // future zinterstore() destination numkeys key [key ...] [weights weight [weight ...]] [aggregate sum|min|max] future zlexcount(const std::string& key, int min, int max) { return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zlexcount(key, min, max, cb); }); } future + zlexcount(const std::string& key, double min, double max) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zlexcount(key, min, max, cb); }); + } + future + zlexcount(const std::string& key, const std::string& min, const std::string& max) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zlexcount(key, min, max, cb); }); + } + future zrange(const std::string& key, int start, int stop, bool withscores = false) { return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zrange(key, start, stop, withscores, cb); }); } + future + zrange(const std::string& key, double start, double stop, bool withscores = false) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zrange(key, start, stop, withscores, cb); }); + } + future + zrange(const std::string& key, const std::string& start, const std::string& stop, bool withscores = false) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zrange(key, start, stop, withscores, cb); }); + } // future zrangebylex() key min max [limit offset count] // future zrevrangebylex() key max min [limit offset count] // future zrangebyscore() key min max [withscores] [limit offset count] @@ -819,17 +851,49 @@ class future_client { return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebylex(key, min, max, cb); }); } future + zremrangebylex(const std::string& key, double min, double max) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebylex(key, min, max, cb); }); + } + future + zremrangebylex(const std::string& key, const std::string& min, const std::string& max) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebylex(key, min, max, cb); }); + } + future zremrangebyrank(const std::string& key, int start, int stop) { return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebyrank(key, start, stop, cb); }); } future + zremrangebyrank(const std::string& key, double start, double stop) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebyrank(key, start, stop, cb); }); + } + future + zremrangebyrank(const std::string& key, const std::string& start, const std::string& stop) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebyrank(key, start, stop, cb); }); + } + future zremrangebyscore(const std::string& key, int min, int max) { return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebyscore(key, min, max, cb); }); } future + zremrangebyscore(const std::string& key, double min, double max) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebyscore(key, min, max, cb); }); + } + future + zremrangebyscore(const std::string& key, const std::string& min, const std::string& max) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zremrangebyscore(key, min, max, cb); }); + } + future zrevrange(const std::string& key, int start, int stop, bool withscores = false) { return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zrevrange(key, start, stop, withscores, cb); }); } + future + zrevrange(const std::string& key, double start, double stop, bool withscores = false) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zrevrange(key, start, stop, withscores, cb); }); + } + future + zrevrange(const std::string& key, const std::string& start, const std::string& stop, bool withscores = false) { + return exec_cmd([=](const rcb_t& cb) -> rc& { return m_client.zrevrange(key, start, stop, withscores, cb); }); + } // future zrevrangebyscore() key max min [withscores] [limit offset count] future zrevrank(const std::string& key, const std::string& member) { diff --git a/includes/cpp_redis/redis_client.hpp b/includes/cpp_redis/redis_client.hpp index 06ca783a..45b73859 100644 --- a/includes/cpp_redis/redis_client.hpp +++ b/includes/cpp_redis/redis_client.hpp @@ -259,19 +259,35 @@ class redis_client { // redis_client& zadd(const reply_callback_t& reply_callback = nullptr) key [nx|xx] [ch] [incr] score member [score member ...] redis_client& zcard(const std::string& key, const reply_callback_t& reply_callback = nullptr); redis_client& zcount(const std::string& key, int min, int max, const reply_callback_t& reply_callback = nullptr); + redis_client& zcount(const std::string& key, double min, double max, const reply_callback_t& reply_callback = nullptr); + redis_client& zcount(const std::string& key, const std::string& min, const std::string& max, const reply_callback_t& reply_callback = nullptr); redis_client& zincrby(const std::string& key, int incr, const std::string& member, const reply_callback_t& reply_callback = nullptr); + redis_client& zincrby(const std::string& key, double incr, const std::string& member, const reply_callback_t& reply_callback = nullptr); + redis_client& zincrby(const std::string& key, const std::string& incr, const std::string& member, const reply_callback_t& reply_callback = nullptr); // redis_client& zinterstore(const reply_callback_t& reply_callback = nullptr) destination numkeys key [key ...] [weights weight [weight ...]] [aggregate sum|min|max] redis_client& zlexcount(const std::string& key, int min, int max, const reply_callback_t& reply_callback = nullptr); + redis_client& zlexcount(const std::string& key, double min, double max, const reply_callback_t& reply_callback = nullptr); + redis_client& zlexcount(const std::string& key, const std::string& min, const std::string& max, const reply_callback_t& reply_callback = nullptr); redis_client& zrange(const std::string& key, int start, int stop, bool withscores = false, const reply_callback_t& reply_callback = nullptr); + redis_client& zrange(const std::string& key, double start, double stop, bool withscores = false, const reply_callback_t& reply_callback = nullptr); + redis_client& zrange(const std::string& key, const std::string& start, const std::string& stop, bool withscores = false, const reply_callback_t& reply_callback = nullptr); // redis_client& zrangebylex(const reply_callback_t& reply_callback = nullptr) key min max [limit offset count] // redis_client& zrevrangebylex(const reply_callback_t& reply_callback = nullptr) key max min [limit offset count] // redis_client& zrangebyscore(const reply_callback_t& reply_callback = nullptr) key min max [withscores] [limit offset count] redis_client& zrank(const std::string& key, const std::string& member, const reply_callback_t& reply_callback = nullptr); redis_client& zrem(const std::string& key, const std::vector& members, const reply_callback_t& reply_callback = nullptr); redis_client& zremrangebylex(const std::string& key, int min, int max, const reply_callback_t& reply_callback = nullptr); + redis_client& zremrangebylex(const std::string& key, double min, double max, const reply_callback_t& reply_callback = nullptr); + redis_client& zremrangebylex(const std::string& key, const std::string& min, const std::string& max, const reply_callback_t& reply_callback = nullptr); redis_client& zremrangebyrank(const std::string& key, int start, int stop, const reply_callback_t& reply_callback = nullptr); + redis_client& zremrangebyrank(const std::string& key, double start, double stop, const reply_callback_t& reply_callback = nullptr); + redis_client& zremrangebyrank(const std::string& key, const std::string& start, const std::string& stop, const reply_callback_t& reply_callback = nullptr); redis_client& zremrangebyscore(const std::string& key, int min, int max, const reply_callback_t& reply_callback = nullptr); + redis_client& zremrangebyscore(const std::string& key, double min, double max, const reply_callback_t& reply_callback = nullptr); + redis_client& zremrangebyscore(const std::string& key, const std::string& min, const std::string& max, const reply_callback_t& reply_callback = nullptr); redis_client& zrevrange(const std::string& key, int start, int stop, bool withscores = false, const reply_callback_t& reply_callback = nullptr); + redis_client& zrevrange(const std::string& key, double start, double stop, bool withscores = false, const reply_callback_t& reply_callback = nullptr); + redis_client& zrevrange(const std::string& key, const std::string& start, const std::string& stop, bool withscores = false, const reply_callback_t& reply_callback = nullptr); // redis_client& zrevrangebyscore(const reply_callback_t& reply_callback = nullptr) key max min [withscores] [limit offset count] redis_client& zrevrank(const std::string& key, const std::string& member, const reply_callback_t& reply_callback = nullptr); redis_client& zscore(const std::string& key, const std::string& member, const reply_callback_t& reply_callback = nullptr); diff --git a/includes/cpp_redis/sync_client.hpp b/includes/cpp_redis/sync_client.hpp index 37db3d53..9c087e74 100644 --- a/includes/cpp_redis/sync_client.hpp +++ b/includes/cpp_redis/sync_client.hpp @@ -771,18 +771,50 @@ class sync_client { return m_client.zcount(key, min, max).get(); } reply + zcount(const std::string& key, double min, double max) { + return m_client.zcount(key, min, max).get(); + } + reply + zcount(const std::string& key, const std::string& min, const std::string& max) { + return m_client.zcount(key, min, max).get(); + } + reply zincrby(const std::string& key, int incr, const std::string& member) { return m_client.zincrby(key, incr, member).get(); } + reply + zincrby(const std::string& key, double incr, const std::string& member) { + return m_client.zincrby(key, incr, member).get(); + } + reply + zincrby(const std::string& key, const std::string& incr, const std::string& member) { + return m_client.zincrby(key, incr, member).get(); + } // reply zinterstore() dest numkeys key [key ...] [weights weight [weight ...]] [aggregate sum|min|max] reply zlexcount(const std::string& key, int min, int max) { return m_client.zlexcount(key, min, max).get(); } reply + zlexcount(const std::string& key, double min, double max) { + return m_client.zlexcount(key, min, max).get(); + } + reply + zlexcount(const std::string& key, const std::string& min, const std::string& max) { + return m_client.zlexcount(key, min, max).get(); + } + reply zrange(const std::string& key, int start, int stop, bool withscores = false) { return m_client.zrange(key, start, stop, withscores).get(); } + reply + zrange(const std::string& key, double start, double stop, bool withscores = false) { + return m_client.zrange(key, start, stop, withscores).get(); + } + reply + zrange(const std::string& key, const std::string& start, const std::string& stop, bool withscores = false) { + return m_client.zrange(key, start, stop, withscores).get(); + } // reply zrangebylex() key min max [limit offset count] // reply zrevrangebylex() key max min [limit offset count] // reply zrangebyscore() key min max [withscores] [limit offset count] @@ -799,17 +831,49 @@ class sync_client { return m_client.zremrangebylex(key, min, max).get(); } reply + zremrangebylex(const std::string& key, double min, double max) { + return m_client.zremrangebylex(key, min, max).get(); + } + reply + zremrangebylex(const std::string& key, const std::string& min, const std::string& max) { + return m_client.zremrangebylex(key, min, max).get(); + } + reply zremrangebyrank(const std::string& key, int start, int stop) { return m_client.zremrangebyrank(key, start, stop).get(); } reply + zremrangebyrank(const std::string& key, double start, double stop) { + return m_client.zremrangebyrank(key, start, stop).get(); + } + reply + zremrangebyrank(const std::string& key, const std::string& start, const std::string& stop) { + return m_client.zremrangebyrank(key, start, stop).get(); + } + reply zremrangebyscore(const std::string& key, int min, int max) { return m_client.zremrangebyscore(key, min, max).get(); } reply + zremrangebyscore(const std::string& key, double min, double max) { + return m_client.zremrangebyscore(key, min, max).get(); + } + reply + zremrangebyscore(const std::string& key, const std::string& min, const std::string& max) { + return m_client.zremrangebyscore(key, min, max).get(); + } + reply zrevrange(const std::string& key, int start, int stop, bool withscores = false) { return m_client.zrevrange(key, start, stop, withscores).get(); } + reply + zrevrange(const std::string& key, double start, double stop, bool withscores = false) { + return m_client.zrevrange(key, start, stop, withscores).get(); + } + reply + zrevrange(const std::string& key, const std::string& start, const std::string& stop, bool withscores = false) { + return m_client.zrevrange(key, start, stop, withscores).get(); + } // reply zrevrangebyscore() key max min [withscores] [limit offset count] reply zrevrank(const std::string& key, const std::string& member) { diff --git a/sources/redis_client.cpp b/sources/redis_client.cpp index 28e7d0d9..724ac381 100644 --- a/sources/redis_client.cpp +++ b/sources/redis_client.cpp @@ -1344,18 +1344,54 @@ redis_client::zcount(const std::string& key, int min, int max, const reply_callb return *this; } +redis_client& +redis_client::zcount(const std::string& key, double min, double max, const reply_callback_t& reply_callback) { + send({"ZCOUNT", key, std::to_string(min), std::to_string(max)}, reply_callback); + return *this; +} + +redis_client& +redis_client::zcount(const std::string& key, const std::string& min, const std::string& max, const reply_callback_t& reply_callback) { + send({"ZCOUNT", key, min, max}, reply_callback); + return *this; +} + redis_client& redis_client::zincrby(const std::string& key, int incr, const std::string& member, const reply_callback_t& reply_callback) { send({"ZINCRBY", key, std::to_string(incr), member}, reply_callback); return *this; } +redis_client& +redis_client::zincrby(const std::string& key, double incr, const std::string& member, const reply_callback_t& reply_callback) { + send({"ZINCRBY", key, std::to_string(incr), member}, reply_callback); + return *this; +} + +redis_client& +redis_client::zincrby(const std::string& key, const std::string& incr, const std::string& member, const reply_callback_t& reply_callback) { + send({"ZINCRBY", key, incr, member}, reply_callback); + return *this; +} + redis_client& redis_client::zlexcount(const std::string& key, int min, int max, const reply_callback_t& reply_callback) { send({"ZLEXCOUNT", key, std::to_string(min), std::to_string(max)}, reply_callback); return *this; } +redis_client& +redis_client::zlexcount(const std::string& key, double min, double max, const reply_callback_t& reply_callback) { + send({"ZLEXCOUNT", key, std::to_string(min), std::to_string(max)}, reply_callback); + return *this; +} + +redis_client& +redis_client::zlexcount(const std::string& key, const std::string& min, const std::string& max, const reply_callback_t& reply_callback) { + send({"ZLEXCOUNT", key, min, max}, reply_callback); + return *this; +} + redis_client& redis_client::zrange(const std::string& key, int start, int stop, bool withscores, const reply_callback_t& reply_callback) { if (withscores) @@ -1365,6 +1401,24 @@ redis_client::zrange(const std::string& key, int start, int stop, bool withscore return *this; } +redis_client& +redis_client::zrange(const std::string& key, double start, double stop, bool withscores, const reply_callback_t& reply_callback) { + if (withscores) + send({"ZRANGE", key, std::to_string(start), std::to_string(stop), "WITHSCORES"}, reply_callback); + else + send({"ZRANGE", key, std::to_string(start), std::to_string(stop)}, reply_callback); + return *this; +} + +redis_client& +redis_client::zrange(const std::string& key, const std::string& start, const std::string& stop, bool withscores, const reply_callback_t& reply_callback) { + if (withscores) + send({"ZRANGE", key, start, stop, "WITHSCORES"}, reply_callback); + else + send({"ZRANGE", key, start, stop}, reply_callback); + return *this; +} + redis_client& redis_client::zrank(const std::string& key, const std::string& member, const reply_callback_t& reply_callback) { send({"ZRANK", key, member}, reply_callback); @@ -1385,18 +1439,54 @@ redis_client::zremrangebylex(const std::string& key, int min, int max, const rep return *this; } +redis_client& +redis_client::zremrangebylex(const std::string& key, double min, double max, const reply_callback_t& reply_callback) { + send({"ZREMRANGEBYLEX", key, std::to_string(min), std::to_string(max)}, reply_callback); + return *this; +} + +redis_client& +redis_client::zremrangebylex(const std::string& key, const std::string& min, const std::string& max, const reply_callback_t& reply_callback) { + send({"ZREMRANGEBYLEX", key, min, max}, reply_callback); + return *this; +} + redis_client& redis_client::zremrangebyrank(const std::string& key, int start, int stop, const reply_callback_t& reply_callback) { send({"ZREMRANGEBYRANK", key, std::to_string(start), std::to_string(stop)}, reply_callback); return *this; } +redis_client& +redis_client::zremrangebyrank(const std::string& key, double start, double stop, const reply_callback_t& reply_callback) { + send({"ZREMRANGEBYRANK", key, std::to_string(start), std::to_string(stop)}, reply_callback); + return *this; +} + +redis_client& +redis_client::zremrangebyrank(const std::string& key, const std::string& start, const std::string& stop, const reply_callback_t& reply_callback) { + send({"ZREMRANGEBYRANK", key, start, stop}, reply_callback); + return *this; +} + redis_client& redis_client::zremrangebyscore(const std::string& key, int min, int max, const reply_callback_t& reply_callback) { send({"ZREMRANGEBYSCORE", key, std::to_string(min), std::to_string(max)}, reply_callback); return *this; } +redis_client& +redis_client::zremrangebyscore(const std::string& key, double min, double max, const reply_callback_t& reply_callback) { + send({"ZREMRANGEBYSCORE", key, std::to_string(min), std::to_string(max)}, reply_callback); + return *this; +} + +redis_client& +redis_client::zremrangebyscore(const std::string& key, const std::string& min, const std::string& max, const reply_callback_t& reply_callback) { + send({"ZREMRANGEBYSCORE", key, min, max}, reply_callback); + return *this; +} + redis_client& redis_client::zrevrange(const std::string& key, int start, int stop, bool withscores, const reply_callback_t& reply_callback) { if (withscores) @@ -1406,6 +1496,24 @@ redis_client::zrevrange(const std::string& key, int start, int stop, bool withsc return *this; } +redis_client& +redis_client::zrevrange(const std::string& key, double start, double stop, bool withscores, const reply_callback_t& reply_callback) { + if (withscores) + send({"ZREVRANGE", key, std::to_string(start), std::to_string(stop), "WITHSCORES"}, reply_callback); + else + send({"ZREVRANGE", key, std::to_string(start), std::to_string(stop)}, reply_callback); + return *this; +} + +redis_client& +redis_client::zrevrange(const std::string& key, const std::string& start, const std::string& stop, bool withscores, const reply_callback_t& reply_callback) { + if (withscores) + send({"ZREVRANGE", key, start, stop, "WITHSCORES"}, reply_callback); + else + send({"ZREVRANGE", key, start, stop}, reply_callback); + return *this; +} + redis_client& redis_client::zrevrank(const std::string& key, const std::string& member, const reply_callback_t& reply_callback) { send({"ZREVRANK", key, member}, reply_callback);