Extract query parameters from a `PostgreSQL` connection URL by splitting on `?`/`&`. This avoids `Url::parse()` which cannot handle multi-host connection strings.
(url: &str)
| 1527 | /// Extract query parameters from a `PostgreSQL` connection URL by splitting on `?`/`&`. |
| 1528 | /// This avoids `Url::parse()` which cannot handle multi-host connection strings. |
| 1529 | fn extract_query_params(url: &str) -> HashMap<String, String> { |
| 1530 | let mut params = HashMap::new(); |
| 1531 | if let Some(query_start) = url.find('?') { |
| 1532 | let query = &url[query_start + 1..]; |
| 1533 | for pair in query.split('&') { |
| 1534 | if let Some((key, value)) = pair.split_once('=') { |
| 1535 | params.insert(key.to_owned(), value.to_owned()); |
| 1536 | } |
| 1537 | } |
| 1538 | } |
| 1539 | params |
| 1540 | } |
| 1541 | |
| 1542 | /// Rebuild the connection URL, removing only SSL-related query parameters. |
| 1543 | /// Other parameters like `target_session_attrs` are preserved for `tokio-postgres`. |