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.
39 lines
649 B
39 lines
649 B
package manager |
|
|
|
import ( |
|
"context" |
|
|
|
"go-common/app/admin/main/videoup/conf" |
|
"go-common/library/database/sql" |
|
bm "go-common/library/net/http/blademaster" |
|
) |
|
|
|
// Dao is redis dao. |
|
type Dao struct { |
|
c *conf.Config |
|
// db |
|
managerDB *sql.DB |
|
httpClient *bm.Client |
|
} |
|
|
|
// New new a dao. |
|
func New(c *conf.Config) (d *Dao) { |
|
d = &Dao{ |
|
c: c, |
|
managerDB: sql.NewMySQL(c.DB.Manager), |
|
httpClient: bm.NewClient(c.HTTPClient.Read), |
|
} |
|
return d |
|
} |
|
|
|
// Close close. |
|
func (d *Dao) Close() { |
|
if d.managerDB != nil { |
|
d.managerDB.Close() |
|
} |
|
} |
|
|
|
// Ping ping cpdb |
|
func (d *Dao) Ping(c context.Context) (err error) { |
|
return d.managerDB.Ping(c) |
|
}
|
|
|