mirror of
https://github.com/iLoveElysia/openbilibili.git
synced 2026-03-14 05:46:26 -05:00
38 lines
606 B
Go
38 lines
606 B
Go
|
|
package service
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
"go-common/app/job/bbq/cms/internal/dao"
|
||
|
|
"go-common/library/conf/paladin"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Service service.
|
||
|
|
type Service struct {
|
||
|
|
ac *paladin.Map
|
||
|
|
dao *dao.Dao
|
||
|
|
}
|
||
|
|
|
||
|
|
// New new a service and return.
|
||
|
|
func New() (s *Service) {
|
||
|
|
var ac = new(paladin.TOML)
|
||
|
|
if err := paladin.Watch("application.toml", ac); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
s = &Service{
|
||
|
|
ac: ac,
|
||
|
|
dao: dao.New(),
|
||
|
|
}
|
||
|
|
return s
|
||
|
|
}
|
||
|
|
|
||
|
|
// Ping ping the resource.
|
||
|
|
func (s *Service) Ping(ctx context.Context) (err error) {
|
||
|
|
return s.dao.Ping(ctx)
|
||
|
|
}
|
||
|
|
|
||
|
|
// Close close the resource.
|
||
|
|
func (s *Service) Close() {
|
||
|
|
s.dao.Close()
|
||
|
|
}
|