package mysql import ( "../../../hotime" "database/sql" _ "github.com/go-sql-driver/mysql" ) func SetDB(appIns *hotime.Application, config hotime.Map) { appIns.SetConnectDB(func(err ...*hotime.Error) *sql.DB { query := config.GetString("user") + ":" + config.GetString("password") + "@tcp(" + config.GetString("host") + ":" + config.GetString("port") + ")/" + config.GetString("name") + "?charset=utf8" DB, e := sql.Open("mysql", query) if e != nil && len(err) != 0 { err[0].SetError(e) } return DB }) appIns.Db.Type = "mysql" }