26#ifndef MYSQL_HARNESS_COMMON_INCLUDED
27#define MYSQL_HARNESS_COMMON_INCLUDED
34#include "harness_export.h"
74template <
class InputIt>
76 const std::string &delim =
"and") {
80 }
else if (elements == 2) {
82 out <<
" " << delim <<
" " << *
start;
84 while (elements-- > 0) {
86 if (elements > 0) out <<
", ";
87 if (elements == 1) out << delim <<
" ";
112template <
class InputIt>
114 const std::string &delim =
"and") {
115 std::stringstream out;
125template <
class Key,
class Value>
127 const Value &default_value) {
128 auto iter =
map.find(
key);
129 if (iter ==
map.end())
return default_value;
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:180
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
bool distance(const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, double *distance, bool *is_null) noexcept
Computes the distance between two geometries.
Definition: distance.cc:40
std::string_view Key
The key type for the hash structure in HashJoinRowBuffer.
Definition: hash_join_buffer.h:108
HARNESS_EXPORT std::string truncate_string(const std::string &str, size_t max_len=80)
Return a truncated version of input string.
Definition: common.cc:32
Value get_from_map(const std::map< Key, Value > &map, const Key &key, const Value &default_value)
Gets a Value from std::map for given Key.
Definition: common.h:126
void serial_comma(std::ostream &out, InputIt start, InputIt finish, const std::string &delim="and")
Emit a range of elements using the serial comma.
Definition: common.h:75
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2894
required string key
Definition: replication_asynchronous_connection_failover.proto:60