MySQL 9.2.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
anonymous_namespace{cluster_metadata_instance_attributes.cc} Namespace Reference

Functions

stdx::expected< std::optional< std::string >, std::string > get_string_attribute (const std::string_view &attributes, const std::string_view &name)
 Returns value for the string field set in the attributes. More...
 
static stdx::expected< bool, std::string > get_bool_tag (const std::map< std::string, std::string, std::less<> > &tags, const std::string_view &name, const bool default_value)
 Returns value for the boolean field set in the attributes. More...
 
std::map< std::string, std::string, std::less<> > get_json_attributes (const rapidjson::Value &obj)
 Get a set of key value pairs from a JSON object. More...
 

Function Documentation

◆ get_bool_tag()

static stdx::expected< bool, std::string > anonymous_namespace{cluster_metadata_instance_attributes.cc}::get_bool_tag ( const std::map< std::string, std::string, std::less<> > &  tags,
const std::string_view &  name,
const bool  default_value 
)
static

Returns value for the boolean field set in the attributes.

Parameters
tagsmap containing tags
namename of the field to be fetched
default_valuevalue to be returned in case the given attribute is not present in the JSON
Return values
valueof the attribute JSON field as boolean
std::nullptrif the given field is missing
errormessage if reading attribute from JSON failed.

◆ get_json_attributes()

std::map< std::string, std::string, std::less<> > anonymous_namespace{cluster_metadata_instance_attributes.cc}::get_json_attributes ( const rapidjson::Value &  obj)

Get a set of key value pairs from a JSON object.

In case when the JSON value is String the value returned is enclosed in "" quotes, otherwise it is serialized as a string.

Parameters
objJSON object containing key value pairs that are going to be serialized.
Returns
key value pairs parsed from JSON object.

◆ get_string_attribute()

stdx::expected< std::optional< std::string >, std::string > anonymous_namespace{cluster_metadata_instance_attributes.cc}::get_string_attribute ( const std::string_view &  attributes,
const std::string_view &  name 
)

Returns value for the string field set in the attributes.

Parameters
attributesstring containing JSON with the attributes
namename of the field to be fetched
Return values
valueof the attribute JSON field as string
std::nullptrif the given field is missing
errormessage if reading attribute from JSON failed.