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

27 lines
765 B

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