mirror of
https://github.com/boostorg/redis.git
synced 2026-01-19 04:42:09 +00:00
Adds new redis hash commands.
This commit is contained in:
@@ -14,7 +14,7 @@ if(AEDIS_USE_CONAN)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/find_conan_packages")
|
||||
endif()
|
||||
|
||||
find_package(Boost 1.71 REQUIRED COMPONENTS system)
|
||||
find_package(Boost 1.74 REQUIRED COMPONENTS system)
|
||||
find_package(fmt 7.0 REQUIRED)
|
||||
|
||||
add_library(aedis INTERFACE)
|
||||
@@ -53,4 +53,4 @@ export(
|
||||
EXPORT aedis-targets
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/aedis-targets.cmake"
|
||||
NAMESPACE aedis::
|
||||
)
|
||||
)
|
||||
|
||||
6
Makefile
6
Makefile
@@ -5,8 +5,10 @@
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
CPPFLAGS += -std=c++17 -g
|
||||
CPPFLAGS += -I/opt/boost_1_71_0/include
|
||||
CPPFLAGS += -DBOOST_ASIO_CONCURRENCY_HINT_1=BOOST_ASIO_CONCURRENCY_HINT_UNSAFE
|
||||
CPPFLAGS += -I/opt/boost_1_74_0/include
|
||||
CPPFLAGS += -D BOOST_ASIO_CONCURRENCY_HINT_1=BOOST_ASIO_CONCURRENCY_HINT_UNSAFE
|
||||
CPPFLAGS += -D BOOST_ASIO_NO_DEPRECATED
|
||||
CPPFLAGS += -D BOOST_ASIO_NO_TS_EXECUTORS
|
||||
|
||||
all: examples tests
|
||||
|
||||
|
||||
28
aedis.hpp
28
aedis.hpp
@@ -470,6 +470,34 @@ auto hset( std::string const& key
|
||||
return resp::assemble("HSET", {key}, std::cbegin(m), std::cend(m), 2);
|
||||
}
|
||||
|
||||
inline
|
||||
auto hincrby(std::string const& key, std::string const& field, int by)
|
||||
{
|
||||
auto par = {field, std::to_string(by)};
|
||||
return resp::assemble("HINCRBY", {key}, std::cbegin(par), std::cend(par));
|
||||
}
|
||||
|
||||
inline
|
||||
auto hkeys(std::string const& key)
|
||||
{
|
||||
std::initializer_list<std::string> par;
|
||||
return resp::assemble("HKEYS", {key}, std::cbegin(par), std::cend(par));
|
||||
}
|
||||
|
||||
inline
|
||||
auto hlen(std::string const& key)
|
||||
{
|
||||
std::initializer_list<std::string> par;
|
||||
return resp::assemble("HLEN", {key});
|
||||
}
|
||||
|
||||
inline
|
||||
auto hgetall(std::string const& key)
|
||||
{
|
||||
std::initializer_list<std::string> par;
|
||||
return resp::assemble("HGETALL", {key});
|
||||
}
|
||||
|
||||
inline
|
||||
auto hvals(std::string const& key)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(Boost 1.71 COMPONENTS system REQUIRED)
|
||||
find_dependency(Boost 1.74 COMPONENTS system REQUIRED)
|
||||
find_dependency(fmt 7.0 REQUIRED)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/aedis-targets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/aedis-targets.cmake")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[requires]
|
||||
boost/1.71.0
|
||||
boost/1.74.0
|
||||
fmt/7.0.2
|
||||
|
||||
[generators]
|
||||
cmake
|
||||
cmake
|
||||
|
||||
@@ -101,7 +101,8 @@ void example1()
|
||||
std::map<std::string, std::string> c
|
||||
{ {{"Name"}, {"Marcelo"}}
|
||||
, {{"Education"}, {"Physics"}}
|
||||
, {{"Job"}, {"Programmer"}}};
|
||||
, {{"Job"}, {"Programmer"}}
|
||||
};
|
||||
|
||||
std::map<int, std::string> d
|
||||
{ {1, {"foo"}}
|
||||
@@ -120,8 +121,11 @@ void example1()
|
||||
+ lrange("b")
|
||||
+ del("b")
|
||||
+ hset("c", c)
|
||||
+ hincrby("c", "Age", 40)
|
||||
+ hmget("c", {"Name", "Education", "Job"})
|
||||
+ hvals("c")
|
||||
+ hlen("c")
|
||||
+ hgetall("c")
|
||||
+ zadd({"d"}, d)
|
||||
+ zrange("d")
|
||||
+ zrangebyscore("foo", 2, -1)
|
||||
|
||||
Reference in New Issue
Block a user