Function from_multi_str

Source
pub fn from_multi_str(i: &str, sep: &str) -> Result<Vec<ConnectionString>>
Expand description

Parse a delimited list of PostgreSQL connection strings into a list of ConnectionStrings.

This function can be useful if you want to take a string input list of connection strings.

ยงExample

use pg_connection_string::{HostSpec, from_multi_str, ConnectionString, Parameter};

assert_eq!(
    from_multi_str("postgres://jack@besthost:34/mydb?host=foohost", ",").unwrap(),
    [
        ConnectionString {
            user: Some("jack".to_string()),
            password: None,
            hostspecs: vec![
                HostSpec {
                    host: "besthost".to_string(),
                    port: Some(34),
                },
                HostSpec {
                    host: "foohost".to_string(),
                    port: None,
                },
            ],
            database: Some("mydb".to_string()),
            parameters: vec![],
            fragment: None,
        },
    ]
);