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

29 rindas
895 B

pirms 6 gadiem
package models
import (
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
)
const(
_DB_NAME = "data/beeblog.db"
_SQLITE3_DRIVER = "sqlite3"
)
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
orm.RegisterModel(new(Attachment),new(User),new(Blog),new(NLabel),new(Note),new(NoteColl),new(Category),new(Like),new(Comment))
pirms 6 gadiem
//orm.RegisterDataBase("default", "mysql", "root:booszy@tcp(127.0.0.1:3306)/beeblog?charset=utf8&loc=Local", 30)
orm.RegisterDataBase("default", "mysql", "root:booszy@tcp(47.98.109.5:3306)/beeblog?charset=utf8&loc=Local", 30)
pirms 6 gadiem
}