go-common/app/admin/main/videoup/dao/oversea/dao.go
2019-04-22 18:49:16 +08:00

43 lines
594 B
Go

package manager
import (
"context"
"github.com/jinzhu/gorm"
"go-common/app/admin/main/videoup/conf"
"go-common/library/database/orm"
)
// Dao is redis dao.
type Dao struct {
c *conf.Config
// db
OverseaDB *gorm.DB
}
var (
d *Dao
)
// New new a dao.
func New(c *conf.Config) (d *Dao) {
d = &Dao{
c: c,
OverseaDB: orm.NewMySQL(c.DB.Oversea),
}
return d
}
// Close close.
func (d *Dao) Close() {
if d.OverseaDB != nil {
d.OverseaDB.Close()
}
}
// Ping ping cpdb
func (d *Dao) Ping(c context.Context) (err error) {
err = d.OverseaDB.DB().PingContext(c)
return
}