MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / run_native_prepared_update_case

Function run_native_prepared_update_case

xtask/src/main.rs:3109–3155  ·  view source on GitHub ↗
(
    runtime: &tokio::runtime::Runtime,
    postgres_bin: &Path,
    initdb_bin: &Path,
    id: &'static str,
    label: &'static str,
    sql: &'static str,
    numeric_updates: &[(i32, i32)],
    t

Source from the content-addressed store, hash-verified

3107
3108#[allow(clippy::too_many_arguments)]
3109fn run_native_prepared_update_case(
3110 runtime: &tokio::runtime::Runtime,
3111 postgres_bin: &Path,
3112 initdb_bin: &Path,
3113 id: &'static str,
3114 label: &'static str,
3115 sql: &'static str,
3116 numeric_updates: &[(i32, i32)],
3117 text_updates: Option<&[(i32, String)]>,
3118 execution: PreparedExecution,
3119) -> Result<PreparedUpdateTest> {
3120 let open_started = Instant::now();
3121 let native = NativePostgres::start(postgres_bin, initdb_bin)?;
3122 let open_micros = open_started.elapsed().as_micros();
3123
3124 runtime.block_on(async {
3125 let mut config = tokio_postgres::Config::new();
3126 configure_native_postgres_client(&mut config, &native);
3127 let connect_started = Instant::now();
3128 let (client, connection) = config
3129 .connect(tokio_postgres::NoTls)
3130 .await
3131 .context("connect native prepared-update client")?;
3132 let connection_task = tokio::spawn(async move {
3133 if let Err(err) = connection.await {
3134 eprintln!("native prepared-update connection error: {err}");
3135 }
3136 });
3137 let connect_micros = connect_started.elapsed().as_micros();
3138
3139 let result = run_tokio_prepared_update_case_on_client(
3140 &client,
3141 id,
3142 label,
3143 sql,
3144 numeric_updates,
3145 text_updates,
3146 execution,
3147 open_micros,
3148 connect_micros,
3149 )
3150 .await;
3151 drop(client);
3152 let _ = connection_task.await;
3153 result
3154 })
3155}
3156
3157#[allow(clippy::too_many_arguments)]
3158async fn run_tokio_prepared_update_case_on_client(

Callers

nothing calls this directly

Calls 3

elapsedMethod · 0.80

Tested by

no test coverage detected