You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: main.rs
    path of file: ./repos/kerkour.com/blog/2022/postgresql_insert_performance/rust/src
    
    the code of the file until where you have to start completion: mod db;

use chrono::{DateTime, Utc};
use db::DB;
use futures::{stream, StreamExt};
use rand::distributions::Alphanumeric;
use rand::Rng;
use serde::{Deserialize, Serialize};
use sqlx::types::Json;
use std::time::{Duration, Instant};
use uuid::Uuid;

const CONCURRENCY: u32 = 100;
const EXECUTIONS: u64 = 50_000;
const RUNS: usize = 7;

#[derive(sqlx::FromRow, Serialize, Debug, Clone, Deserialize)]
struct Event {
    id: uuid::Uuid,
    r#type: String,
    timestamp: DateTime<Utc>,
    received_at: DateTime<Utc>,
    payload: Json<Payload>,
}

#[derive(sqlx::FromRow, Serialize, Debug, Clone
    
async fn insert_key_value_compressed_zstd(db: &DB) {
    const QUERY: &str = "INSERT INTO key_value_compressed_zstd (key, value)
        VALUES ($1, $2)";
    let stream = stream::iter(0..EXECUTIONS);
    let base_event = generate_event();
    let key_value_event = KeyValueEvent {
        key: base_event.id,
        value: serde_json::to_vec(&base_event)
            .expect("key_value_compressed_zstd: serializing event"),
    };

    stream
        .for_each_concurrent(CONCURRENCY as usize, |_| {
            let mut event = key_value_event.clone();
            event.key = Uuid::new_v4();
            async move {
                event.value = tokio::task::spawn_blocking(move || {
                    zstd::bulk::compress(&event.value, 2)
                        .expect("key_value_compressed_zstd :compressing event")
                })
                .await
                .expect("key_value_compressed_zstd: awaiting for tokio::spawn_blocking");

                sqlx::query(QUERY)
                    .bind(&event.key)
                    .bind(&event.value)
                    .execute(db)
                    .await
                    .expect("key_value_compressed: inserting event");
            }
        })
        .await;
}