Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.

Commit 8332ea2

Browse files
committed
Provide documentation for the reply class
1 parent 9ea181a commit 8332ea2

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,58 @@ main(void) {
395395
}
396396
```
397397
398+
## Reply
399+
`reply` is the class that wraps redis server replies. That is, `reply` objects are passed as parameters of commands callbacks and contain the server's response.
400+
401+
### Methods
402+
403+
#### bool is_array(void) const
404+
Returns whether the reply is an array or not.
405+
406+
#### bool is_string(void) const
407+
Returns whether the reply is a string (simple string or bulk string) or not.
408+
409+
#### bool is_simple_string(void) const
410+
Returns whether the reply is a simple string or not.
411+
412+
#### bool is_bulk_string(void) const
413+
Returns whether the reply is a bulk string or not.
414+
415+
#### bool is_error(void) const
416+
Returns whether the reply is an error or not.
417+
418+
#### bool is_integer(void) const
419+
Returns whether the reply is an integer or not.
420+
421+
#### bool is_null(void) const
422+
Returns whether the reply is null or not.
423+
424+
#### const std::vector<reply>& as_array(void) const
425+
Returns the reply as an array.
426+
Behavior is undefined if the reply is not an array.
427+
428+
#### const std::string& as_string(void) const
429+
Returns the reply as a string.
430+
Behavior is undefined if the reply is not a string.
431+
432+
#### int as_integer(void) const
433+
Returns the reply as an integer.
434+
Behavior is undefined if the reply is not an integer.
435+
436+
#### type get_type(void) const
437+
Return the type of the reply. The possible values are the following:
438+
439+
```cpp
440+
enum class type {
441+
array,
442+
bulk_string,
443+
error,
444+
integer,
445+
simple_string,
446+
null
447+
};
448+
```
449+
398450
## Examples
399451
Some examples are provided in this repository:
400452
* [redis_client.cpp](examples/redis_client.cpp) shows how to use the redis client class.

0 commit comments

Comments
 (0)