Skip to content

Commit 17aaf53

Browse files
committed
format the queries for more read-friendly
Signed-off-by: Kaviraj <[email protected]>
1 parent 2a34102 commit 17aaf53

File tree

4 files changed

+64
-52
lines changed

4 files changed

+64
-52
lines changed

examples/clickhouse_api/ephemeral_http.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ func EphemeralColumnHTTP() error {
1313
defer conn.Close()
1414

1515
ctx := context.Background()
16-
ddl := `CREATE OR REPLACE TABLE test
17-
(
18-
id UInt64,
19-
unhexed String EPHEMERAL,
20-
hexed FixedString(4) DEFAULT unhex(unhexed)
21-
)
22-
ENGINE = MergeTree
23-
ORDER BY id;`
16+
ddl := `
17+
CREATE OR REPLACE TABLE test
18+
(
19+
id UInt64,
20+
unhexed String EPHEMERAL,
21+
hexed FixedString(4) DEFAULT unhex(unhexed)
22+
)
23+
ENGINE = MergeTree
24+
ORDER BY id;`
25+
2426
if err := conn.Exec(ctx, ddl); err != nil {
2527
return err
2628
}
@@ -31,11 +33,12 @@ ORDER BY id;`
3133
return err
3234
}
3335

34-
query := `SELECT
35-
id,
36-
hexed,
37-
hex(hexed)
38-
FROM test;`
36+
query := `
37+
SELECT
38+
id,
39+
hexed,
40+
hex(hexed)
41+
FROM test;`
3942

4043
rows, err := conn.Query(ctx, query)
4144
if err != nil {

examples/clickhouse_api/ephemeral_native.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ func EphemeralColumnNative() error {
1313
defer conn.Close()
1414

1515
ctx := context.Background()
16-
ddl := `CREATE OR REPLACE TABLE test
17-
(
18-
id UInt64,
19-
unhexed String EPHEMERAL,
20-
hexed FixedString(4) DEFAULT unhex(unhexed)
21-
)
22-
ENGINE = MergeTree
23-
ORDER BY id;`
16+
ddl := `
17+
CREATE OR REPLACE TABLE test
18+
(
19+
id UInt64,
20+
unhexed String EPHEMERAL,
21+
hexed FixedString(4) DEFAULT unhex(unhexed)
22+
)
23+
ENGINE = MergeTree
24+
ORDER BY id;`
25+
2426
if err := conn.Exec(ctx, ddl); err != nil {
2527
return err
2628
}
@@ -31,11 +33,12 @@ ORDER BY id;`
3133
return err
3234
}
3335

34-
query := `SELECT
35-
id,
36-
hexed,
37-
hex(hexed)
38-
FROM test;`
36+
query := `
37+
SELECT
38+
id,
39+
hexed,
40+
hex(hexed)
41+
FROM test;`
3942

4043
rows, err := conn.Query(ctx, query)
4144
if err != nil {

examples/std/ephemeral_http.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ func EphemeralColumnHTTP() error {
1515
defer conn.Close()
1616

1717
ctx := context.Background()
18-
ddl := `CREATE OR REPLACE TABLE test
19-
(
20-
id UInt64,
21-
unhexed String EPHEMERAL,
22-
hexed FixedString(4) DEFAULT unhex(unhexed)
23-
)
24-
ENGINE = MergeTree
25-
ORDER BY id;`
18+
ddl := `
19+
CREATE OR REPLACE TABLE test
20+
(
21+
id UInt64,
22+
unhexed String EPHEMERAL,
23+
hexed FixedString(4) DEFAULT unhex(unhexed)
24+
)
25+
ENGINE = MergeTree
26+
ORDER BY id;`
27+
2628
_, err = conn.ExecContext(ctx, ddl)
2729
if err != nil {
2830
return err
@@ -35,11 +37,12 @@ ORDER BY id;`
3537
return err
3638
}
3739

38-
query := `SELECT
39-
id,
40-
hexed,
41-
hex(hexed)
42-
FROM test;`
40+
query := `
41+
SELECT
42+
id,
43+
hexed,
44+
hex(hexed)
45+
FROM test;`
4346

4447
rows, err := conn.QueryContext(ctx, query)
4548
if err != nil {

examples/std/ephemeral_native.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ func EphemeralColumnNative() error {
1515
defer conn.Close()
1616

1717
ctx := context.Background()
18-
ddl := `CREATE OR REPLACE TABLE test
19-
(
20-
id UInt64,
21-
unhexed String EPHEMERAL,
22-
hexed FixedString(4) DEFAULT unhex(unhexed)
23-
)
24-
ENGINE = MergeTree
25-
ORDER BY id;`
18+
ddl := `
19+
CREATE OR REPLACE TABLE test
20+
(
21+
id UInt64,
22+
unhexed String EPHEMERAL,
23+
hexed FixedString(4) DEFAULT unhex(unhexed)
24+
)
25+
ENGINE = MergeTree
26+
ORDER BY id;`
27+
2628
_, err = conn.ExecContext(ctx, ddl)
2729
if err != nil {
2830
return err
@@ -35,11 +37,12 @@ ORDER BY id;`
3537
return err
3638
}
3739

38-
query := `SELECT
39-
id,
40-
hexed,
41-
hex(hexed)
42-
FROM test;`
40+
query := `
41+
SELECT
42+
id,
43+
hexed,
44+
hex(hexed)
45+
FROM test;`
4346

4447
rows, err := conn.QueryContext(ctx, query)
4548
if err != nil {

0 commit comments

Comments
 (0)