26#ifndef MYSQLROUTER_CONFIG_BUILDER_INCLUDED
27#define MYSQLROUTER_CONFIG_BUILDER_INCLUDED
45 using kv_type = std::pair<std::string, std::string>;
51 const std::string §ion,
const std::initializer_list<kv_type> &pairs) {
56 const std::vector<kv_type> &pairs) {
61 const std::string §ion,
62 const std::map<std::string, std::string> &pairs) {
70 return pair.first +
"=" + pair.second;
74 template <
class SectionType>
76 const SectionType &pairs) {
77 std::vector<std::string> lines{
"[" + section +
"]"};
79 for (
const auto &pair : pairs) {
builder for MySQL Router config files.
Definition: config_builder.h:43
static std::string build_section_(const std::string §ion, const SectionType &pairs)
Definition: config_builder.h:75
static std::string build_section(const std::string §ion, const std::vector< kv_type > &pairs)
Definition: config_builder.h:55
static std::string build_section(const std::string §ion, const std::map< std::string, std::string > &pairs)
Definition: config_builder.h:60
static std::string build_pair(const kv_type &pair)
build a string from a key-value pair.
Definition: config_builder.h:69
static std::string build_section(const std::string §ion, const std::initializer_list< kv_type > &pairs)
build a config file section from key-value pairs.
Definition: config_builder.h:50
std::pair< std::string, std::string > kv_type
Definition: config_builder.h:45
std::string join(const detail::range auto &rng, std::string_view delim)
join elements of a range into a string separated by a delimiter.
Definition: string.h:74