码农笔录博客源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
523 B

пре 6 година
package models
import (
пре 4 година
"fmt"
"github.com/beego/beego/v2/client/orm"
"github.com/beego/beego/v2/core/config"
пре 6 година
_ "github.com/go-sql-driver/mysql"
пре 6 година
)
пре 6 година
func RegistDB() {
пре 4 година
dbUrl, _ := config.String("dburl")
fmt.Println(dbUrl)
orm.RegisterDriver("mysql", orm.DRMySQL)
orm.RegisterDataBase("default", "mysql", "root:"+dbUrl+"/beeblog?charset=utf8&loc=Local")
пре 6 година
orm.RegisterModel(new(User), new(Blog), new(NLabel), new(Note), new(NoteColl), new(Category), new(Like), new(Comment))
пре 4 година
//orm.RunSyncdb("default", false, true)
пре 6 година
}