Documentation ¶
Overview ¶
Package rkclickhouse is an implementation of rkentry.Entry which could be used gorm.DB instance.
Index ¶
- Constants
- func RegisterClickHouseEntryYAML(raw []byte) map[string]rkentry.Entry
- type BootConfig
- type BootConfigE
- type ClickHouseEntry
- func (entry *ClickHouseEntry) Bootstrap(ctx context.Context)
- func (entry *ClickHouseEntry) GetDB(name string) *gorm.DB
- func (entry *ClickHouseEntry) GetDescription() string
- func (entry *ClickHouseEntry) GetName() string
- func (entry *ClickHouseEntry) GetType() string
- func (entry *ClickHouseEntry) Interrupt(ctx context.Context)
- func (entry *ClickHouseEntry) IsHealthy() bool
- func (entry *ClickHouseEntry) RegisterPromMetrics(registry *prometheus.Registry) error
- func (entry *ClickHouseEntry) String() string
- type Logger
- func (l *Logger) Error(ctx context.Context, msg string, data ...interface{})
- func (l *Logger) Info(ctx context.Context, msg string, data ...interface{})
- func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, ...)
- func (l *Logger) Warn(ctx context.Context, msg string, data ...interface{})
- type Option
- func WithAddr(addr string) Option
- func WithDatabase(name string, dryRun, autoCreate bool, params ...string) Option
- func WithDescription(description string) Option
- func WithLogger(logger *Logger) Option
- func WithName(name string) Option
- func WithPass(pass string) Option
- func WithPlugin(name string, plugin gorm.Plugin) Option
- func WithUser(user string) Option
Constants ¶
const ClickHouseEntryType = "ClickHouseEntry"
Variables ¶
This section is empty.
Functions ¶
func RegisterClickHouseEntryYAML ¶ added in v1.0.0
RegisterClickHouseEntryYAML register ClickHouseEntry based on config file into rkentry.GlobalAppCtx
Types ¶
type BootConfig ¶
type BootConfig struct {
ClickHouse []*BootConfigE `yaml:"clickhouse" json:"clickhouse"`
}
BootConfig ClickHouse entry boot config which reflects to YAML config
type BootConfigE ¶ added in v1.1.0
type BootConfigE struct { Enabled bool `yaml:"enabled" json:"enabled"` Name string `yaml:"name" json:"name"` Description string `yaml:"description" json:"description"` Domain string `yaml:"domain" json:"domain"` User string `yaml:"user" json:"user"` Pass string `yaml:"pass" json:"pass"` Addr string `yaml:"addr" json:"addr"` Database []struct { Name string `yaml:"name" json:"name"` Params []string `yaml:"params" json:"params"` DryRun bool `yaml:"dryRun" json:"dryRun"` AutoCreate bool `yaml:"autoCreate" json:"autoCreate"` Plugins struct { Prom plugins.PromConfig `yaml:"prom"` } `yaml:"plugins" json:"plugins"` } `yaml:"database" json:"database"` Logger struct { Entry string `json:"entry" yaml:"entry"` Level string `json:"level" yaml:"level"` Encoding string `json:"encoding" yaml:"encoding"` OutputPaths []string `json:"outputPaths" yaml:"outputPaths"` SlowThresholdMs int `json:"slowThresholdMs" yaml:"slowThresholdMs"` IgnoreRecordNotFoundError bool `json:"ignoreRecordNotFoundError" yaml:"ignoreRecordNotFoundError"` } `json:"logger" yaml:"logger"` }
type ClickHouseEntry ¶
type ClickHouseEntry struct { User string `yaml:"-" json:"-"` Addr string `yaml:"-" json:"-"` GormDbMap map[string]*gorm.DB `yaml:"-" json:"-"` GormConfigMap map[string]*gorm.Config `yaml:"-" json:"-"` // contains filtered or unexported fields }
ClickHouseEntry will init gorm.DB or SqlMock with provided arguments
func GetClickHouseEntry ¶
func GetClickHouseEntry(name string) *ClickHouseEntry
GetClickHouseEntry returns ClickHouseEntry instance
func RegisterClickHouseEntry ¶
func RegisterClickHouseEntry(opts ...Option) *ClickHouseEntry
RegisterClickHouseEntry will register Entry into GlobalAppCtx
func (*ClickHouseEntry) Bootstrap ¶
func (entry *ClickHouseEntry) Bootstrap(ctx context.Context)
Bootstrap ClickHouseEntry
func (*ClickHouseEntry) GetDB ¶
func (entry *ClickHouseEntry) GetDB(name string) *gorm.DB
GetDB returns gorm.DB
func (*ClickHouseEntry) GetDescription ¶
func (entry *ClickHouseEntry) GetDescription() string
GetDescription returns entry description
func (*ClickHouseEntry) GetName ¶
func (entry *ClickHouseEntry) GetName() string
GetName returns entry name
func (*ClickHouseEntry) GetType ¶
func (entry *ClickHouseEntry) GetType() string
GetType returns entry type
func (*ClickHouseEntry) Interrupt ¶
func (entry *ClickHouseEntry) Interrupt(ctx context.Context)
Interrupt ClickHouseEntry
func (*ClickHouseEntry) IsHealthy ¶
func (entry *ClickHouseEntry) IsHealthy() bool
IsHealthy checks healthy status remote provider
func (*ClickHouseEntry) RegisterPromMetrics ¶ added in v1.2.7
func (entry *ClickHouseEntry) RegisterPromMetrics(registry *prometheus.Registry) error
func (*ClickHouseEntry) String ¶
func (entry *ClickHouseEntry) String() string
String returns json marshalled string
type Logger ¶
type Logger struct { SlowThreshold time.Duration IgnoreRecordNotFoundError bool LogLevel gormLogger.LogLevel // contains filtered or unexported fields }
func (*Logger) LogMode ¶ added in v1.2.5
func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface
type Option ¶
type Option func(*ClickHouseEntry)
func WithDatabase ¶
WithDatabase provide database
func WithDescription ¶
WithDescription provide name.