Skip to content

Commit

Permalink
Add clickhouse database support
Browse files Browse the repository at this point in the history
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
  • Loading branch information
patrickpichler committed Feb 5, 2024
1 parent d0751d8 commit 45b5eaa
Show file tree
Hide file tree
Showing 11 changed files with 1,010 additions and 9 deletions.
455 changes: 455 additions & 0 deletions dialect/clickhouse.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions dialect/keyword.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ const (
DatabaseDriverOracle DatabaseDriver = "oracle"
DatabaseDriverH2 DatabaseDriver = "h2"
DatabaseDriverVertica DatabaseDriver = "vertica"
DatabaseDriverClickhouse DatabaseDriver = "clickhouse"
)

func DataBaseKeywords(driver DatabaseDriver) []string {
Expand All @@ -413,6 +414,8 @@ func DataBaseKeywords(driver DatabaseDriver) []string {
return h2Keywords
case DatabaseDriverVertica:
return verticaKeywords
case DatabaseDriverClickhouse:
return clickhouseKeywords
default:
return sqliteKeywords
}
Expand Down Expand Up @@ -440,6 +443,8 @@ func DataBaseFunctions(driver DatabaseDriver) []string {
return []string{}
case DatabaseDriverVertica:
return verticaReservedWords
case DatabaseDriverClickhouse:
return []string{}
default:
return []string{}
}
Expand Down
14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ require (
)

require (
github.com/ClickHouse/ch-go v0.58.2 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.17.1 // indirect
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/elastic/go-sysinfo v1.11.2 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/godror/knownpb v0.1.1 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
Expand All @@ -39,18 +45,26 @@ require (
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/pgtype v1.14.0 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/paulmach/orb v0.10.0 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
howett.net/plist v1.0.1 // indirect
)
60 changes: 60 additions & 0 deletions go.sum

Large diffs are not rendered by default.

Loading

0 comments on commit 45b5eaa

Please sign in to comment.