You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
342 B
Go

package config
type Database struct {
Host string
Port string
Username string
Password string
Dbname string
}
func (d *Database) GetDsn() string {
if d.Port == "" {
d.Port = "3306"
}
return d.Username + ":" + d.Password + "@tcp(" + d.Host + ":" + d.Port + ")/" + d.Dbname + "?charset=utf8mb4&parseTime=True&loc=Local"
}