Skip to content

Commit fc96163

Browse files
author
Patrick Pichler
committed
Add clickhouse database support
This adds initial support for the clickhouse database system. Keywords are currently based upon postgres, as the clickhouse docs do not provide a good overview of all allowed keywords. fix #53
1 parent d0751d8 commit fc96163

File tree

11 files changed

+1010
-9
lines changed

11 files changed

+1010
-9
lines changed

dialect/clickhouse.go

Lines changed: 455 additions & 0 deletions
Large diffs are not rendered by default.

dialect/keyword.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ const (
389389
DatabaseDriverOracle DatabaseDriver = "oracle"
390390
DatabaseDriverH2 DatabaseDriver = "h2"
391391
DatabaseDriverVertica DatabaseDriver = "vertica"
392+
DatabaseDriverClickhouse DatabaseDriver = "clickhouse"
392393
)
393394

394395
func DataBaseKeywords(driver DatabaseDriver) []string {
@@ -413,6 +414,8 @@ func DataBaseKeywords(driver DatabaseDriver) []string {
413414
return h2Keywords
414415
case DatabaseDriverVertica:
415416
return verticaKeywords
417+
case DatabaseDriverClickhouse:
418+
return clickhouseKeywords
416419
default:
417420
return sqliteKeywords
418421
}
@@ -440,6 +443,8 @@ func DataBaseFunctions(driver DatabaseDriver) []string {
440443
return []string{}
441444
case DatabaseDriverVertica:
442445
return verticaReservedWords
446+
case DatabaseDriverClickhouse:
447+
return []string{}
443448
default:
444449
return []string{}
445450
}

go.mod

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@ require (
2424
)
2525

2626
require (
27+
github.com/ClickHouse/ch-go v0.58.2 // indirect
28+
github.com/ClickHouse/clickhouse-go/v2 v2.17.1 // indirect
29+
github.com/andybalholm/brotli v1.0.6 // indirect
2730
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
2831
github.com/elastic/go-sysinfo v1.11.2 // indirect
2932
github.com/elastic/go-windows v1.0.1 // indirect
33+
github.com/go-faster/city v1.0.1 // indirect
34+
github.com/go-faster/errors v0.6.1 // indirect
3035
github.com/go-logfmt/logfmt v0.6.0 // indirect
3136
github.com/godror/knownpb v0.1.1 // indirect
3237
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
3338
github.com/golang-sql/sqlexp v0.1.0 // indirect
39+
github.com/google/uuid v1.5.0 // indirect
3440
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
3541
github.com/jackc/pgconn v1.14.1 // indirect
3642
github.com/jackc/pgio v1.0.0 // indirect
@@ -39,18 +45,26 @@ require (
3945
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
4046
github.com/jackc/pgtype v1.14.0 // indirect
4147
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
48+
github.com/klauspost/compress v1.16.7 // indirect
4249
github.com/mattn/go-colorable v0.1.6 // indirect
4350
github.com/mattn/go-isatty v0.0.12 // indirect
4451
github.com/mattn/go-runewidth v0.0.15 // indirect
52+
github.com/paulmach/orb v0.10.0 // indirect
53+
github.com/pierrec/lz4/v4 v4.1.18 // indirect
4554
github.com/pkg/errors v0.9.1 // indirect
4655
github.com/prometheus/procfs v0.12.0 // indirect
4756
github.com/rivo/uniseg v0.4.4 // indirect
4857
github.com/russross/blackfriday/v2 v2.1.0 // indirect
58+
github.com/segmentio/asm v1.2.0 // indirect
59+
github.com/shopspring/decimal v1.3.1 // indirect
4960
github.com/sirupsen/logrus v1.9.3 // indirect
5061
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect
62+
go.opentelemetry.io/otel v1.19.0 // indirect
63+
go.opentelemetry.io/otel/trace v1.19.0 // indirect
5164
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect
5265
golang.org/x/sys v0.15.0 // indirect
5366
golang.org/x/text v0.14.0 // indirect
5467
google.golang.org/protobuf v1.32.0 // indirect
68+
gopkg.in/yaml.v3 v3.0.1 // indirect
5569
howett.net/plist v1.0.1 // indirect
5670
)

go.sum

Lines changed: 60 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)