docs(config): add method description

This commit is contained in:
Denis Gukov 2024-11-23 15:23:20 +05:00
parent a481a23c75
commit 80be12d0d5

View File

@ -731,11 +731,17 @@ func (d *DbConfig) GetConnectionString(includeDbName bool) (connectionString str
return return
} }
// PrintDbInfo prints the database connection information based on the current configuration.
// It retrieves the database dialect and prints the corresponding connection details.
// If the dialect is not found, it panics with an error message.
func (conf *ConfigType) PrintDbInfo() { func (conf *ConfigType) PrintDbInfo() {
// Get the database dialect
dialect, err := conf.GetDialect() dialect, err := conf.GetDialect()
if err != nil { if err != nil {
panic(err) panic(err)
} }
// Print database connection information based on the dialect
switch dialect { switch dialect {
case DbDriverMySQL: case DbDriverMySQL:
fmt.Printf("MySQL %v@%v %v\n", conf.MySQL.GetUsername(), conf.MySQL.GetHostname(), conf.MySQL.GetDbName()) fmt.Printf("MySQL %v@%v %v\n", conf.MySQL.GetUsername(), conf.MySQL.GetHostname(), conf.MySQL.GetDbName())