|
testcontainers-cpp 0.2.0
Native C++20 Testcontainers over the Docker Engine API
|
Assembles a connection URL — scheme://[user[:password]@]host[:port][/database][?key=value&...] — percent-encoding every component that needs it. More...
#include <testcontainers/ConnectionString.hpp>
Public Member Functions | |
| ConnectionString (std::string scheme) | |
| ConnectionString & | with_user (std::string user) |
| ConnectionString & | with_password (std::string password) |
| ConnectionString & | with_host (std::string host) |
| ConnectionString & | with_port (std::uint16_t port) |
| ConnectionString & | with_database (std::string database) |
| The path segment after the host — the database name for the typical DB DSN (also e.g. | |
| ConnectionString & | with_param (std::string key, std::string value) |
| Append one key=value query parameter (repeatable; order kept). | |
| std::string | to_string () const |
| Render the URL from the components set so far. | |
Assembles a connection URL — scheme://[user[:password]@]host[:port][/database][?key=value&...] — percent-encoding every component that needs it.
The building block for module connection getters (postgresql://user:pass@localhost:5432/db), usable on its own for any URL-shaped DSN.
Components stay out of the URL until set: no user/password → no userinfo "@", no port → no ":port", no database → no path, no params → no "?". user / password / database / parameter keys and values are percent-encoded (RFC 3986 unreserved characters pass through), so credentials with '@', ':' or '/' survive verbatim; the database is one path segment (a '/' inside it is encoded, not a separator). The scheme is emitted as given; so is the host, except an IPv6 literal, which is bracketed automatically. Parameters keep their insertion order.
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
The path segment after the host — the database name for the typical DB DSN (also e.g.
an AMQP vhost or a Redis database index).
|
inline |
Append one key=value query parameter (repeatable; order kept).
| std::string testcontainers::ConnectionString::to_string | ( | ) | const |
Render the URL from the components set so far.