码农笔录博客源码
您最多能選擇 25 個主題 主題必須以字母或數字為開頭,可包含連接號「-」且最長為 35 個字元。

30 行
815 B

6 年前
package models
import (
"github.com/astaxie/beego"
//"github.com/Unknwon/com"
//"os"
//"path"
6 年前
"github.com/astaxie/beego/orm"
//_ "github.com/mattn/go-sqlite3"
_ "github.com/go-sql-driver/mysql"
6 年前
)
const (
_DB_NAME = "data/beeblog.db"
6 年前
_SQLITE3_DRIVER = "sqlite3"
)
func RegistDB() {
//if !com.IsExist(_DB_NAME){
// os.MkdirAll(path.Dir(_DB_NAME),os.ModePerm)
// os.Create(_DB_NAME)
//}
//orm.RegisterModel(new(Attachment),new(Topic))
//orm.RegisterDriver(_SQLITE3_DRIVER,orm.DRSqlite)
//orm.RegisterDataBase("default",_SQLITE3_DRIVER,_DB_NAME,10)
orm.RegisterModel(new(User), new(Blog), new(NLabel), new(Note), new(NoteColl), new(Category), new(Like), new(Comment))
orm.RegisterDataBase("default", "mysql", "root:"+beego.AppConfig.String("dburl")+"/beeblog?charset=utf8&loc=Local", 30)
}