一、解决方案:
方案一:
orm.Debug = false
orm.DefaultTimeLoc = time.UTC
orm.RegisterDriver("mysql", orm.DRMySQL)
orm.RegisterDataBase("default", "mysql", "root:LPET6Plus@tcp(127.0.0.1:18283)/lpet6plusdb?charset=utf8&loc=Local")
orm.RegisterModel(new(Versions))
orm.RegisterModel(new(Regversions))
orm.RegisterModel(new(Osversions))
方案二:
func init() {
var datasource = "db_test:dbtestqwe321@tcp(127.0.0.1:3306)/db_test?charset=utf8&loc=Asia%2FShanghai"
orm.RegisterDataBase("default", "mysql", datasource, 30)
orm.DefaultTimeLoc = time.Local
orm.RegisterModel(new(Category), new(Topic))
orm.RunSyncdb("default", false, true)
}