Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Sep 5, 2024
1 parent 63eec86 commit 720464f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
25 changes: 22 additions & 3 deletions tests/it/insert.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
use crate::{
create_rename_table, create_simple_table, fetch_rows, flush_query_log, RenameRow, SimpleRow,
};
use crate::{create_simple_table, fetch_rows, flush_query_log, SimpleRow};
use clickhouse::{sql::Identifier, Row};
use serde::{Deserialize, Serialize};

#[derive(Debug, Row, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct RenameRow {
#[serde(rename = "fix_id")]
pub fix_id: i64,
#[serde(rename = "extComplexId")]
pub complex_id: String,
pub ext_float: f64,
}

async fn create_rename_table(client: &Client, table_name: &str) {
client
.query("CREATE TABLE ?(fixId UInt64, extComplexId String, extFloat Float64) ENGINE = MergeTree ORDER BY fixId")
.bind(Identifier(table_name))
.execute()
.await
.unwrap();
}

#[tokio::test]
async fn keeps_client_options() {
Expand Down
19 changes: 0 additions & 19 deletions tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ impl SimpleRow {
}
}

#[derive(Debug, Row, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct RenameRow {
#[serde(rename = "fix_id")]
pub fix_id: i64,
#[serde(rename = "extComplexId")]
pub complex_id: String,
pub ext_float: f64,
}

async fn create_simple_table(client: &Client, table_name: &str) {
client
.query("CREATE TABLE ?(id UInt64, data String) ENGINE = MergeTree ORDER BY id")
Expand All @@ -49,15 +39,6 @@ async fn create_simple_table(client: &Client, table_name: &str) {
.unwrap();
}

async fn create_rename_table(client: &Client, table_name: &str) {
client
.query("CREATE TABLE ?(fixId UInt64, extComplexId String, extFloat Float64) ENGINE = MergeTree ORDER BY fixId")
.bind(Identifier(table_name))
.execute()
.await
.unwrap();
}

async fn fetch_rows<T>(client: &Client, table_name: &str) -> Vec<T>
where
T: Row + for<'b> Deserialize<'b>,
Expand Down

0 comments on commit 720464f

Please sign in to comment.