sewenew/redis-plus-plus

[BUG] asyncRedis hmget command no instance of overloaded function

conde2 opened this issue · 2 comments

Describe the bug
I always receive compiling errors while trying to use the hmget command with asyncRedis

To Reproduce

			std::vector<std::string> fields= {"k1", "k2", "k3"};
			asyncRedis->hmget("hash", fields.begin(), fields.end());
			asyncRedis->hmget("hash", {"field1", "field2"});

Expected behavior
Be able to use hmget command with asyncRedis

Environment:

  • OS: windows x64
  • Compiler: Microsoft Visual Studio
  • hiredis version: latest
  • redis-plus-plus version: latest

AsyncRedis::hmget is a template method, you should specify a template parameter, i.e. the type of hmget's result:

auto vals = r.hmget<vector<OptionalString>>("key", {"k", "k1"}).get();
for (auto &val : vals) {
        if (val)
            cout << *val << endl;
        else
            cout << "not exist" << endl;
}

Regards

Thank you, it was not stated on the documentation so I thought it was the same as the sync version.