You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
462 B
33 lines
462 B
package dao |
|
|
|
import ( |
|
"context" |
|
|
|
"go-common/app/infra/notify/conf" |
|
xsql "go-common/library/database/sql" |
|
) |
|
|
|
// Dao dao |
|
type Dao struct { |
|
c *conf.Config |
|
db *xsql.DB |
|
} |
|
|
|
// New init mysql db |
|
func New(c *conf.Config) (dao *Dao) { |
|
dao = &Dao{ |
|
c: c, |
|
db: xsql.NewMySQL(c.MySQL), |
|
} |
|
return |
|
} |
|
|
|
// Close close the resource. |
|
func (dao *Dao) Close() { |
|
dao.db.Close() |
|
} |
|
|
|
// Ping dao ping |
|
func (dao *Dao) Ping(c context.Context) error { |
|
return dao.db.Ping(c) |
|
}
|
|
|