go-common/app/job/main/creative/dao/academy/dao.go

35 lines
504 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package academy
import (
"context"
"go-common/app/job/main/creative/conf"
"go-common/library/database/sql"
)
// Dao is creative dao.
type Dao struct {
// config
c *conf.Config
// db
db *sql.DB
}
// New init api url
func New(c *conf.Config) (d *Dao) {
d = &Dao{
c: c,
db: sql.NewMySQL(c.DB.Creative),
}
return
}
// Ping creativeDb
func (d *Dao) Ping(c context.Context) (err error) {
return d.db.Ping(c)
}
// Close creativeDb
func (d *Dao) Close() (err error) {
return d.db.Close()
}