Ditto 4.6.0
|
Provides an interface to specify a path to a key in a document ID that you can then call a function on to get the value at the specified key as a specific type. More...
#include <DocumentIdPath.hpp>
Public Member Functions | |
DocumentIdPath | operator[] (std::string key) |
DocumentIdPath | operator[] (std::size_t index) |
std::string | get_string_value () const |
Returns the value at the previously specified key in the document ID as a std::string . If the key was invalid a default value of an empty string will be returned. | |
int | get_int_value () const |
Returns the value at the previously specified key in the document ID as an int . If the key was invalid a default value of 0 will be returned. | |
double | get_double_value () const |
Returns the value at the previously specified key in the document ID as a double . If the key was invalid a default value of 0 will be returned. | |
float | get_float_value () const |
Returns the value at the previously specified key in the document ID as a float . If the key was invalid a default value of 0 will be returned. | |
bool | get_bool_value () const |
Returns the value at the previously specified key in the document ID as a bool . If the key was invalid a default value of false will be returned. | |
nlohmann::json | get_json () const |
Returns the value at the previously specified key in the document ID as a nlohmann::json object. If the key was invalid the return value will be a nullptr . | |
Provides an interface to specify a path to a key in a document ID that you can then call a function on to get the value at the specified key as a specific type.
You obtain a DocumentIdPath
by subscripting a DocumentId
and you can then further subscript a DocumentIdPath
to further specify the key of the document ID that you want to get the value of.
bool ditto::DocumentIdPath::get_bool_value | ( | ) | const |
Returns the value at the previously specified key in the document ID as a bool
. If the key was invalid a default value of false will be returned.
bool
. The return value will be false if the key was invalid or the value was not a boolean type. double ditto::DocumentIdPath::get_double_value | ( | ) | const |
Returns the value at the previously specified key in the document ID as a double
. If the key was invalid a default value of 0 will be returned.
double
. The return value will be 0 if the key was invalid or the value was not a numeric type. float ditto::DocumentIdPath::get_float_value | ( | ) | const |
Returns the value at the previously specified key in the document ID as a float
. If the key was invalid a default value of 0 will be returned.
float
. The return value will be 0 if the key was invalid or the value was not a numeric type. int ditto::DocumentIdPath::get_int_value | ( | ) | const |
Returns the value at the previously specified key in the document ID as an int
. If the key was invalid a default value of 0 will be returned.
int
. The return value will be 0 if the key was invalid or the value was not a numeric type. json ditto::DocumentIdPath::get_json | ( | ) | const |
Returns the value at the previously specified key in the document ID as a nlohmann::json
object. If the key was invalid the return value will be a nullptr
.
nlohmann::json
object. The return value will be a nullptr
if the key was invalid. std::string ditto::DocumentIdPath::get_string_value | ( | ) | const |
Returns the value at the previously specified key in the document ID as a std::string
. If the key was invalid a default value of an empty string will be returned.
std::string
. The return value will be an empty string if the key was invalid or the value was not a string.