Skip to content

Commit

Permalink
Add pgdsn parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Oct 3, 2024
1 parent 42c94da commit c9649f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions edgedb-tokio/src/raw/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,20 @@ async fn connect4(cfg: &Config, mut stream: TlsStream) -> Result<Connection, Err
};
server_params.set::<PostgresAddress>(pgaddr);
}
#[cfg(feature = "unstable")]
b"pgdsn" => {
use crate::server_params::PostgresDsn;

let pgdsn = match str::from_utf8(&par.value) {
Ok(a) => a.to_owned(),
Err(e) => {
log::warn!("Can't decode param {:?}: {}", par.name, e);
continue;
}
};

server_params.set::<PostgresDsn>(PostgresDsn(pgdsn));
}
b"system_config" => {
handle_system_config(par, &mut server_params)?;
}
Expand Down
9 changes: 9 additions & 0 deletions edgedb-tokio/src/server_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ impl ServerParam for PostgresAddress {

impl SealedParam for PostgresAddress {}

#[derive(Debug)]
pub struct PostgresDsn(pub String);

impl ServerParam for PostgresDsn {
type Value = PostgresDsn;
}

impl SealedParam for PostgresDsn {}

/// ParameterStatus_SystemConfig
#[derive(Debug)]
pub struct SystemConfig {
Expand Down

0 comments on commit c9649f9

Please sign in to comment.