Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClickHouseDB ¶
type ClickHouseDB struct {
// contains filtered or unexported fields
}
func NewClickHouseDB ¶
func NewClickHouseDB(config conf.DBClickHouseConfig) *ClickHouseDB
NewClickHouseDB creates a new instance of ClickHouseDB, configuring it with options for automatic migration, the DSN key, and the models to be migrated.
Parameters:
- config: conf.DBClickHouseConfig struct containing AutoMigrate flag, the DSN key, and models slice for database migration.
Returns:
- A new ClickHouseDB instance.
func (*ClickHouseDB) GetDB ¶
func (d *ClickHouseDB) GetDB() *gorm.DB
GetDB returns the active ClickHouse database connection.
Returns:
- The *gorm.DB instance representing the database connection.
func (*ClickHouseDB) InitDB ¶
func (d *ClickHouseDB) InitDB()
InitDB initializes the ClickHouse database connection using GORM and the provided DSN. If auto-migration is enabled, it will migrate the provided models automatically.
If auto-migration is disabled, the method will log that manual migration is expected.
Logs an error and terminates the program if the database connection or migration fails.
Click to show internal directories.
Click to hide internal directories.