package models
import (
"fmt"
"github.com/beego/beego/v2/client/orm"
"github.com/beego/beego/v2/server/web"
_ "github.com/go-sql-driver/mysql"
)
func RegistDB() {
dbUrl, _ := web.AppConfig.String("dburl")
fmt.Println(dbUrl)
orm.RegisterDriver("mysql", orm.DRMySQL)
orm.RegisterDataBase("default", "mysql", "root:"+dbUrl+"/beeblog?charset=utf8&loc=Local")
orm.RegisterModel(new(User), new(Blog), new(NLabel), new(Category))
orm.RunSyncdb("default", false, true)
}