码农笔录博客源码
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.

30 lines
815 B

пре 6 година
package models
import (
пре 6 година
"github.com/astaxie/beego"
пре 6 година
//"github.com/Unknwon/com"
//"os"
//"path"
пре 6 година
"github.com/astaxie/beego/orm"
пре 6 година
//_ "github.com/mattn/go-sqlite3"
_ "github.com/go-sql-driver/mysql"
пре 6 година
)
пре 6 година
const (
_DB_NAME = "data/beeblog.db"
пре 6 година
_SQLITE3_DRIVER = "sqlite3"
)
пре 6 година
func RegistDB() {
пре 6 година
//if !com.IsExist(_DB_NAME){
// os.MkdirAll(path.Dir(_DB_NAME),os.ModePerm)
// os.Create(_DB_NAME)
//}
пре 6 година
//orm.RegisterModel(new(Attachment),new(Topic))
пре 6 година
//orm.RegisterDriver(_SQLITE3_DRIVER,orm.DRSqlite)
//orm.RegisterDataBase("default",_SQLITE3_DRIVER,_DB_NAME,10)
пре 6 година
пре 6 година
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)
}