Documentation
¶
Index ¶
- func ClickhouseValidateConfig(clickhouseConfig *ClickhouseConfig) error
- type ClickhouseConfig
- type ClickhouseSession
- func (ch *ClickhouseSession) Close() error
- func (ch *ClickhouseSession) Conn() driver.Conn
- func (chsession *ClickhouseSession) Connect(ch *ClickhouseConfig, context context.Context) error
- func (ch *ClickhouseSession) Exec(ctx context.Context, stmt string) error
- func (ch *ClickhouseSession) Query(ctx context.Context, query string) (driver.Rows, error)
- type ClickhouseSessionInterface
- type ConfigLoaderInterface
- type ConfigValidatorInterface
- type DefaultConfigLoader
- type DefaultConfigValidator
- type DefaultSessionFactory
- type SessionFactoryInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClickhouseValidateConfig ¶
func ClickhouseValidateConfig(clickhouseConfig *ClickhouseConfig) error
validateConfig validates the loaded configuration.
Types ¶
type ClickhouseConfig ¶
type ClickhouseConfig struct { ChHostname string `mapstructure:"chhostname"` ChUsername string `mapstructure:"chusername"` ChPassword string `mapstructure:"chpassword"` ChDatabase string `mapstructure:"chdatabase"` ChSkipVerify string `mapstructure:"chskipverify"` ChPort string `mapstructure:"chport"` }
func ClickhouseLoadConfig ¶
func ClickhouseLoadConfig() (*ClickhouseConfig, error)
LoadConfig loads the configuration from environment variables using Viper.
type ClickhouseSession ¶
type ClickhouseSession struct {
// contains filtered or unexported fields
}
ClickhouseSession implements ClickhouseSessionInterface
func NewClickhouseSession ¶
func NewClickhouseSession(ch *ClickhouseConfig, context context.Context) (*ClickhouseSession, error)
NewClickhouseSession creates a new Clickhouse session.
func (*ClickhouseSession) Close ¶
func (ch *ClickhouseSession) Close() error
Close ClickHouse connection
func (*ClickhouseSession) Conn ¶
func (ch *ClickhouseSession) Conn() driver.Conn
return ClickHouse connection
func (*ClickhouseSession) Connect ¶
func (chsession *ClickhouseSession) Connect(ch *ClickhouseConfig, context context.Context) error
Connect to ClickHouse database
type ClickhouseSessionInterface ¶ added in v1.3.26
type ClickhouseSessionInterface interface { Connect(ch *ClickhouseConfig, context context.Context) error Query(ctx context.Context, query string) (driver.Rows, error) Exec(ctx context.Context, stmt string) error Close() error Conn() driver.Conn }
ClickhouseSessionInterface defines the interface for ClickHouse session operations
type ConfigLoaderInterface ¶ added in v1.3.26
type ConfigLoaderInterface interface {
LoadConfig() (*ClickhouseConfig, error)
}
ConfigLoaderInterface defines the interface for configuration loading
type ConfigValidatorInterface ¶ added in v1.3.26
type ConfigValidatorInterface interface {
ValidateConfig(config *ClickhouseConfig) error
}
ConfigValidatorInterface defines the interface for configuration validation
type DefaultConfigLoader ¶ added in v1.3.26
type DefaultConfigLoader struct{}
DefaultConfigLoader implements ConfigLoaderInterface
func (*DefaultConfigLoader) LoadConfig ¶ added in v1.3.26
func (c *DefaultConfigLoader) LoadConfig() (*ClickhouseConfig, error)
LoadConfig implements ConfigLoaderInterface
type DefaultConfigValidator ¶ added in v1.3.26
type DefaultConfigValidator struct{}
DefaultConfigValidator implements ConfigValidatorInterface
func (*DefaultConfigValidator) ValidateConfig ¶ added in v1.3.26
func (v *DefaultConfigValidator) ValidateConfig(config *ClickhouseConfig) error
ValidateConfig implements ConfigValidatorInterface
type DefaultSessionFactory ¶ added in v1.3.26
type DefaultSessionFactory struct{}
DefaultSessionFactory implements SessionFactoryInterface
func (*DefaultSessionFactory) NewSession ¶ added in v1.3.26
func (f *DefaultSessionFactory) NewSession( ch *ClickhouseConfig, context context.Context, ) (ClickhouseSessionInterface, error)
NewSession implements SessionFactoryInterface
type SessionFactoryInterface ¶ added in v1.3.26
type SessionFactoryInterface interface {
NewSession(ch *ClickhouseConfig, context context.Context) (ClickhouseSessionInterface, error)
}
SessionFactoryInterface defines the interface for creating ClickHouse sessions