Closed redboltz closed 5 months ago
Hi @redboltz, refer to the Null section in the docs, namely, replace response<std::string> foo;
with response<std::optional<std::string>> foo;
@criatura2 , thank you for the prompt response. It works fine! In my script case, the value of optional is not important. So I use the following typealias for the no-return value script execution.
using nil_t = std::optional<int>; // int is an example type of small size and no include dependency
Problem
Redis supports server side script that is written by lua. Some of script do something but return nothing. Here is
redis-cli
example that execute (eval) empty script.I think it does nothing but not error. It is similar to C++ function
void f() {}
.The important point is that script return nothing.
I worte a code that does the same thing using Boost.Redis (1.84.0)
I got the following result:
I think that the script is not error but
resp.has_error()
return true.When I replace
with
, invalid lua script, then I got the following result:
C++ program:
In this case, the error is expected result.
My observation
I think that lua script does not have errors but return nothing seems treat invalidly in Boost.Redis. Or my response type
redis::response<std::string>
could be wrong. But I'm not sure what type is appropriate.