码农笔录博客源码
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

30 rindas
815 B

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