22 std::istringstream stream(connect_string);
25 while (stream >> token)
28 size_t pos = token.find(
'=');
29 if (pos == std::string::npos)
34 std::string key = token.substr(0, pos);
35 std::string value = token.substr(pos + 1);
38 if (!value.empty() && value.front() ==
'\'' && value.back() ==
'\'')
40 value = value.substr(1, value.length() - 2);
44 if (key ==
"host" || key ==
"hostname")
48 else if (key ==
"port")
52 config.
port =
static_cast<uint16_t
>(std::stoi(value));
59 else if (key ==
"database" || key ==
"dbname" || key ==
"db")
63 else if (key ==
"user" || key ==
"username")
67 else if (key ==
"password" || key ==
"pass" || key ==
"pwd")