-
Notifications
You must be signed in to change notification settings - Fork 554
Replies
cpp_redis::reply
is the class that wraps Redis server replies.
That is, cpp_redis::reply
objects are passed as parameters of commands callbacks and contain the server's response.
bool ok(void) const
Returns true if the reply is not an error (same as !is_error()
).
bool ko(void) const
Returns true if the reply is an error (same as is_error()
).
const std::string& error(void) const
Returns the error if the reply is an error (same as as_string()
)
Throws cpp_redis::redis_error if the reply is not an error.
operator bool(void) const
Implicit conversion of reply into bool.
Returns true if the reply is not null and not an error (same as !is_null() && is_ok()
).
bool is_array(void) const
Returns whether the reply is an array or not.
bool is_string(void) const
Returns whether the reply is a string (simple string or bulk string) or not.
bool is_simple_string(void) const
Returns whether the reply is a simple string or not.
bool is_bulk_string(void) const
Returns whether the reply is a bulk string or not.
bool is_error(void) const
Returns whether the reply is an error or not.
bool is_integer(void) const
Returns whether the reply is an integer or not.
bool is_null(void) const
Returns whether the reply is null or not.
const std::vector<reply>& as_array(void) const
Returns the reply as an array.
Throws cpp_redis::redis_error if the reply is not an array.
const std::string& as_string(void) const
Returns the reply as a string.
Throws cpp_redis::redis_error if the reply is not a string.
int64_t as_integer(void) const
Returns the reply as an integer.
Throws cpp_redis::redis_error if the reply is not an integer.
type get_type(void) const
Return the type of the reply. The possible values are the following:
enum class type {
array,
bulk_string,
error,
integer,
simple_string,
null
};
Need more information? Contact me.