replace_database_in_connection_string

Function replace_database_in_connection_string 

Source
pub fn replace_database_in_connection_string(
    url: &str,
    new_db: &str,
) -> Result<String>
Expand description

Replace the database name in a connection string URL

This is used internally by SerenDB to provide a generic connection string which then needs to be specialized for a particular database.

§Arguments

  • url - The connection string URL (e.g., postgresql://host/template_db)
  • new_db - The new database name to insert into the URL

§Returns

A new URL string with the database name replaced.

§Errors

Returns an error if the URL is invalid and cannot be parsed.