package main import ( "git.nonolive.co/eson.hsm/databoard-collect/database" "github.com/474420502/perfectshutdown" "github.com/go-xorm/xorm" ) var ps = perfectshutdown.New() // mongodb 驱动 var mdb = database.NewStatisticsDB("mongodb://sg-board1.livenono.com:27018") // 默认全局的数据库对象 var db *Database = func() *Database { db := &Database{} // 初始化数据myrocks驱动链接 engine, err := xorm.NewEngine("mysql", "root:Nono-databoard@tcp(sg-board1.livenono.com:3306)/databoard?parseTime=true&loc=Local&charset=utf8&collation=utf8_unicode_ci") if err != nil { panic(err) } db.engine = engine // 数据库表对象 db.T.CountLiveAnchors = engine.Table("count_live_anchors") return db }()