|
@@ -1,8 +1,7 @@
|
|
|
-package clickhouse
|
|
|
+package config
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
- "git.beejay.kim/Craft/Api/config"
|
|
|
"github.com/ClickHouse/clickhouse-go/v2"
|
|
|
"strings"
|
|
|
)
|
|
@@ -16,7 +15,7 @@ var compressionMap = map[string]clickhouse.CompressionMethod{
|
|
|
"br": clickhouse.CompressionBrotli,
|
|
|
}
|
|
|
|
|
|
-type Config struct {
|
|
|
+type ClickhouseConfig struct {
|
|
|
Username string `json:"username" yaml:"username"`
|
|
|
Password string `json:"password" yaml:"password"`
|
|
|
Host string `json:"host" yaml:"host"`
|
|
@@ -32,7 +31,7 @@ type params struct {
|
|
|
WriteTimeout int `json:"write_timeout" yaml:"write-timeout"`
|
|
|
}
|
|
|
|
|
|
-func (c *Config) Invalidate() error {
|
|
|
+func (c *ClickhouseConfig) Invalidate() error {
|
|
|
if strings.TrimSpace(c.Username) == "" {
|
|
|
c.Username = "default"
|
|
|
}
|
|
@@ -49,7 +48,7 @@ func (c *Config) Invalidate() error {
|
|
|
return fmt.Errorf("`clickhouse.database` must not be an empty string")
|
|
|
}
|
|
|
|
|
|
- return config.Invalidate(c)
|
|
|
+ return Invalidate(c)
|
|
|
}
|
|
|
|
|
|
func (p params) Invalidate() error {
|
|
@@ -73,5 +72,5 @@ func (p params) Invalidate() error {
|
|
|
return fmt.Errorf("`clickhouse.params.write-timeout` must not be at least 1")
|
|
|
}
|
|
|
|
|
|
- return config.Invalidate(&p)
|
|
|
+ return Invalidate(&p)
|
|
|
}
|