app-cloudep-tweeting-service/internal/svc/service_context.go

26 lines
538 B
Go
Raw Normal View History

2024-08-30 02:44:35 +00:00
package svc
import (
"app-cloudep-tweeting-service/internal/config"
model "app-cloudep-tweeting-service/internal/model/mongo"
vi "code.30cm.net/digimon/library-go/validator"
)
type ServiceContext struct {
Config config.Config
Validate vi.Validate
2024-08-30 06:30:39 +00:00
PostModel model.PostModel
CommentModel model.CommentModel
2024-08-30 02:44:35 +00:00
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
2024-08-30 06:30:39 +00:00
Config: c,
Validate: vi.MustValidator(),
PostModel: MustPostModel(c),
CommentModel: MustCommentModel(c),
2024-08-30 02:44:35 +00:00
}
}