完成剩余模块 Context 超时控制改造
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package admindashboard
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
)
|
||||
|
||||
var ErrDependencyUnavailable = errors.New("dependency unavailable")
|
||||
|
||||
@@ -12,9 +15,9 @@ func NewService(repo *Repository) *Service {
|
||||
return &Service{repo: repo}
|
||||
}
|
||||
|
||||
func (s *Service) Summary() (*DashboardDTO, error) {
|
||||
func (s *Service) Summary(ctx context.Context) (*DashboardDTO, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
}
|
||||
return s.repo.Summary()
|
||||
return s.repo.Summary(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user