Skip to content

Commit 5c36d12

Browse files
author
Jove Zhong
committed
keep log message format consistent, rename some to test_stream
1 parent 4722ef1 commit 5c36d12

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

examples/prepare/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ impl<'a> MyRow<'a> {
1717

1818
#[tokio::main]
1919
async fn main() -> Result<()> {
20-
println!("{} Start", FN_NAME);
20+
println!("{}Start", FN_NAME);
2121

2222
println!("{}Build client", FN_NAME);
2323
let client = ProtonClient::new("http://localhost:8123");
2424

25-
println!("{} Create stream if not exists", FN_NAME);
25+
println!("{}Create stream if not exists", FN_NAME);
2626
create_stream(&client)
2727
.await
2828
.expect("[main]: Failed to create Stream");
@@ -39,19 +39,19 @@ async fn main() -> Result<()> {
3939

4040
println!("{}Inserted data: {}", FN_NAME, count);
4141

42-
println!("{} Stop", FN_NAME);
42+
println!("{}Stop", FN_NAME);
4343
Ok(())
4444
}
4545

4646
pub async fn create_stream(client: &ProtonClient) -> Result<()> {
4747
client
48-
.execute_query("CREATE STREAM IF NOT EXISTS some(no uint32, name string) ORDER BY no")
48+
.execute_query("CREATE STREAM IF NOT EXISTS test_stream(no uint32, name string) ORDER BY no")
4949
.await
5050
}
5151

5252
pub async fn insert(client: &ProtonClient) -> Result<()> {
5353
let mut insert = client
54-
.insert("some")
54+
.insert("test_stream")
5555
.await
5656
.expect("[main/insert]: Failed to build inserter for table some");
5757

@@ -70,7 +70,7 @@ pub async fn insert(client: &ProtonClient) -> Result<()> {
7070
pub async fn select_count(client: &ProtonClient) -> Result<u64> {
7171
let count = client
7272
.clone()
73-
.fetch_one("select count() from table(some)")
73+
.fetch_one("select count() from table(test_stream)")
7474
.await
7575
.expect("[main/select_count]: Failed to fetch count()");
7676

examples/query/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ async fn main() -> Result<()> {
5050
.await
5151
.expect("[main/fetch_all]: Failed to fetch data");
5252

53-
println!("{} Stop", FN_NAME);
53+
println!("{}Stop", FN_NAME);
5454
Ok(())
5555
}
5656

5757
pub async fn fetch(client: &ProtonClient) -> clickhouse::error::Result<()> {
5858
let mut cursor = client
59-
.fetch::<MyRow<'_>>("SELECT ?fields from table(some) WHERE no BETWEEN 500 AND 504")
59+
.fetch::<MyRow<'_>>("SELECT ?fields from test_stream WHERE no BETWEEN 500 AND 504")
6060
.await
6161
.expect("[main/fetch]: Failed to fetch data");
6262

@@ -69,7 +69,7 @@ pub async fn fetch(client: &ProtonClient) -> clickhouse::error::Result<()> {
6969

7070
pub async fn fetch_all(client: &ProtonClient) -> clickhouse::error::Result<()> {
7171
let vec = client
72-
.fetch_all::<MyRowOwned>("SELECT ?fields from table(some) WHERE no BETWEEN 500 AND 504")
72+
.fetch_all::<MyRowOwned>("SELECT ?fields from test_stream WHERE no BETWEEN 500 AND 504")
7373
.await
7474
.expect("[main/fetch_all]: Failed to fetch all");
7575

examples/remove/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ const FN_NAME: &str = "[prepare]:";
44

55
#[tokio::main]
66
async fn main() -> Result<()> {
7-
println!("{} Start", FN_NAME);
7+
println!("{}Start", FN_NAME);
88

99
println!("{}Build client", FN_NAME);
1010
let client = ProtonClient::new("http://localhost:8123");
1111

12-
println!("{} Delete Stream", FN_NAME);
12+
println!("{}Delete Stream", FN_NAME);
1313
delete_stream(&client)
1414
.await
1515
.expect("[main]: Failed to delete Stream");
1616

17-
println!("{} Stop", FN_NAME);
17+
println!("{}Stop", FN_NAME);
1818

1919
Ok(())
2020
}
2121

2222
pub async fn delete_stream(client: &ProtonClient) -> Result<()> {
2323
// Drop a stream
2424
// https://docs.timeplus.com/proton-drop-stream
25-
client.execute_query("DROP STREAM some").await
25+
client.execute_query("DROP STREAM IF EXISTS test_stream").await
2626
}

0 commit comments

Comments
 (0)