fusenapi/initalize/service.go
2023-10-10 14:58:36 +08:00

34 lines
1.1 KiB
Go

package initalize
import (
"fusenapi/service/repositories"
"fusenapi/utils/queue"
"github.com/aws/aws-sdk-go/aws/session"
"gorm.io/gorm"
)
type Repositories struct {
ImageHandle repositories.ImageHandle
NewResource repositories.Resource
NewShoppingCart repositories.ShoppingCart
NewOrder repositories.Order
}
type NewAllRepositorieData struct {
GormDB *gorm.DB
BLMServiceUrl *string
BLMServicePorts []string
AwsSession *session.Session
DelayQueue *queue.DelayMessage
}
func NewAllRepositories(newData *NewAllRepositorieData) *Repositories {
return &Repositories{
ImageHandle: repositories.NewImageHandle(newData.GormDB, newData.BLMServiceUrl, newData.BLMServicePorts, newData.AwsSession),
NewShoppingCart: repositories.NewShoppingCart(newData.GormDB, newData.BLMServiceUrl, newData.AwsSession),
NewResource: repositories.NewResource(newData.GormDB, newData.BLMServiceUrl, newData.AwsSession),
NewOrder: repositories.NewOrder(newData.GormDB, newData.BLMServiceUrl, newData.AwsSession, newData.DelayQueue),
}
}