MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / connection_uri

Method connection_uri

src/pglite/server.rs:85–101  ·  view source on GitHub ↗

Return a PostgreSQL connection URI for the local server.

(&self)

Source from the content-addressed store, hash-verified

83
84 /// Return a PostgreSQL connection URI for the local server.
85 pub fn connection_uri(&self) -> String {
86 match &self.endpoint {
87 ServerEndpoint::Tcp(addr) => tcp_connection_uri(*addr, &self.startup_config),
88 #[cfg(unix)]
89 ServerEndpoint::Unix(path) => {
90 let host = path.parent().unwrap_or_else(|| Path::new("/tmp"));
91 let port = parse_unix_socket_port(path).unwrap_or(5432);
92 format!(
93 "postgresql://{}@/{}?host={}&port={}&sslmode=disable",
94 self.startup_config.username,
95 self.startup_config.database,
96 percent_encode_query_value(&host.display().to_string()),
97 port
98 )
99 }
100 }
101 }
102
103 /// Alias for [`connection_uri`](Self::connection_uri).
104 pub fn database_url(&self) -> String {

Calls 2

tcp_connection_uriFunction · 0.85
parse_unix_socket_portFunction · 0.85

Tested by

no test coverage detected