app-cloudep-order-server/internal/svc/service_context.go

28 lines
577 B
Go
Raw Normal View History

2024-10-06 07:02:30 +00:00
package svc
2024-10-12 09:49:58 +00:00
import (
"app-cloudep-order-server/internal/config"
model "app-cloudep-order-server/internal/model/mongo"
ers "code.30cm.net/digimon/library-go/errs"
"code.30cm.net/digimon/library-go/errs/code"
vi "code.30cm.net/digimon/library-go/validator"
)
2024-10-06 07:02:30 +00:00
type ServiceContext struct {
2024-10-12 09:49:58 +00:00
Config config.Config
Validate vi.Validate
OrderModel model.OrderModel
2024-10-06 07:02:30 +00:00
}
func NewServiceContext(c config.Config) *ServiceContext {
2024-10-12 09:49:58 +00:00
ers.Scope = code.CloudEPOrder
2024-10-06 07:02:30 +00:00
return &ServiceContext{
2024-10-12 09:49:58 +00:00
Config: c,
Validate: vi.MustValidator(),
OrderModel: MustOrderModel(c),
2024-10-06 07:02:30 +00:00
}
}