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" }