Skip to content

Commit

Permalink
Warnings (#1378)
Browse files Browse the repository at this point in the history
  • Loading branch information
aljazerzen authored Oct 12, 2024
1 parent 593c100 commit 4c9e89f
Show file tree
Hide file tree
Showing 30 changed files with 328 additions and 121 deletions.
10 changes: 6 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 43 additions & 24 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

edgedb = {
url = "github:edgedb/packages-nix";
inputs.fenix.follows = "fenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-parts.follows = "flake-parts";
};
Expand All @@ -27,8 +28,7 @@

common = [
# needed for running tests
# edgedb.packages.${system}.edgedb-server
edgedb.packages.${system}.edgedb-server-5_0_beta
edgedb.packages.${system}.edgedb-server-nightly
] ++ pkgs.lib.optional pkgs.stdenv.isDarwin [
pkgs.libiconv
pkgs.darwin.apple_sdk.frameworks.CoreServices
Expand Down
11 changes: 5 additions & 6 deletions src/branch/connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ impl BranchConnection<'_> {
)
.await?;

print::completion(
branch
.connection
.execute(&format!("drop branch {} force", self.branch_name), &())
.await?,
);
let (status, _warnings) = branch
.connection
.execute(&format!("drop branch {} force", self.branch_name), &())
.await?;
print::completion(status);

// should never happen, but just to make sure
if branch.is_temp {
Expand Down
2 changes: 1 addition & 1 deletion src/branch/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub async fn create_branch(
format!("create {kind} branch {new_branch} from {from}")
};

let status = connection.execute(&query, &()).await?;
let (status, _warnings) = connection.execute(&query, &()).await?;
print::completion(status);
Ok(())
}
2 changes: 1 addition & 1 deletion src/branch/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub async fn main(
statement = format!("{} force", &statement);
}

let status = connection.execute(&statement, &()).await?;
let (status, _warnings) = connection.execute(&statement, &()).await?;

print::completion(status);

Expand Down
10 changes: 5 additions & 5 deletions src/branch/rebase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub async fn main(
eprintln!("Cleaning up cloned branch...");
let mut rename_connection =
get_connection_to_modify(&temp_branch, cli_opts, source_connection).await?;
let result = rename_connection
let (status, _warnings) = rename_connection
.connection
.execute(
&format!(
Expand All @@ -58,7 +58,7 @@ pub async fn main(
)
.await?;

print::completion(result);
print::completion(status);

rename_connection.clean().await
}
Expand Down Expand Up @@ -88,7 +88,7 @@ async fn rebase(

// drop source branch
eprintln!("\nReplacing '{}' with rebased version...", current_branch);
let status = target_connection
let (status, _warnings) = target_connection
.execute(
&format!(
"drop branch {} force",
Expand All @@ -112,7 +112,7 @@ async fn rename_temp_to_source(
) -> anyhow::Result<()> {
let mut rename_connection = get_connection_to_modify(temp_branch, options, connection).await?;

let status = rename_connection
let (status, _warnings) = rename_connection
.connection
.execute(
&format!(
Expand All @@ -136,7 +136,7 @@ async fn clone_target_branch(branch: &str, connection: &mut Connection) -> anyho

let temp_branch_name = Uuid::new_v4().to_string();

let status = connection
let (status, _warnings) = connection
.execute(
&format!(
"create data branch {} from {}",
Expand Down
2 changes: 1 addition & 1 deletion src/branch/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub async fn main(
}

async fn rename(connection: &mut Connection, options: &Rename) -> anyhow::Result<()> {
let status = connection
let (status, _warnings) = connection
.execute(
&format!(
"alter branch {0}{2} rename to {1}",
Expand Down
2 changes: 1 addition & 1 deletion src/branch/wipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub async fn main(
}
}

let status = connection.execute("RESET SCHEMA TO initial", &()).await?;
let (status, _warnings) = connection.execute("RESET SCHEMA TO initial", &()).await?;

print::completion(status);

Expand Down
43 changes: 22 additions & 21 deletions src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ async fn set(
) -> Result<(), anyhow::Error> {
let cast = cast.unwrap_or_default();
let query = format!("CONFIGURE INSTANCE SET {name} := {cast}{value}");
print::completion(&cli.execute(&query, &()).await?);
let (status, _warnings) = cli.execute(&query, &()).await?;
print::completion(&status);
Ok(())
}

Expand Down Expand Up @@ -54,8 +55,8 @@ pub async fn configure(
if let Some(ref comment_text) = comment {
props.push(format!("comment := {}", quote_string(comment_text)))
}
print::completion(
&cli.execute(
let (status, _warnings) = cli
.execute(
&format!(
r###"
CONFIGURE INSTANCE INSERT Auth {{
Expand All @@ -66,8 +67,8 @@ pub async fn configure(
),
&(),
)
.await?,
);
.await?;
print::completion(&status);
Ok(())
}
C::Set(Set {
Expand All @@ -78,25 +79,25 @@ pub async fn configure(
.map(|x| quote_string(x))
.collect::<Vec<_>>()
.join(", ");
print::completion(
&cli.execute(
let (status, _warnings) = cli
.execute(
&format!("CONFIGURE INSTANCE SET listen_addresses := {{{addresses}}}"),
&(),
)
.await?,
);
.await?;
print::completion(&status);
Ok(())
}
C::Set(Set {
parameter: S::ListenPort(param),
}) => {
print::completion(
&cli.execute(
let (status, _warnings) = cli
.execute(
&format!("CONFIGURE INSTANCE SET listen_port := {}", param.port),
&(),
)
.await?,
);
.await?;
print::completion(&status);
Ok(())
}
C::Set(Set {
Expand Down Expand Up @@ -167,13 +168,13 @@ pub async fn configure(
.map(|x| quote_string(x))
.collect::<Vec<_>>()
.join(", ");
print::completion(
&cli.execute(
let (status, _warnings) = cli
.execute(
&format!("CONFIGURE INSTANCE SET cors_allow_origins := {{{values}}}"),
&(),
)
.await?,
);
.await?;
print::completion(&status);
Ok(())
}
C::Set(Set {
Expand Down Expand Up @@ -220,10 +221,10 @@ pub async fn configure(
C::StoreMigrationSdl => "store_migration_sdl",
C::NetHttpMaxConnections => "net_http_max_connections",
};
print::completion(
&cli.execute(&format!("CONFIGURE INSTANCE RESET {name}"), &())
.await?,
);
let (status, _warnings) = cli
.execute(&format!("CONFIGURE INSTANCE RESET {name}"), &())
.await?;
print::completion(&status);
Ok(())
}
}
Expand Down
Loading

0 comments on commit 4c9e89f

Please sign in to comment.