repository.go 2.4 KB
package factory

import (
	"github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain"
	"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/infrastructure/repository"
)

func CreatePartnerCategoryRepository(options map[string]interface{}) (domain.PartnerCategoryRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewPartnerCategoryRepository(transactionContext)
}

func CreatePermissionRepository(options map[string]interface{}) (domain.PermissionRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewPermissionRepository(transactionContext)
}

func CreateUserAuthRepository(options map[string]interface{}) (domain.UserAuthRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewUserAuthRepository(transactionContext)
}

func CreateOrderRepository(options map[string]interface{}) (domain.OrderRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewOrderRepository(transactionContext)
}

func CreateGoodsRepository(options map[string]interface{}) (domain.GoodsRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewGoodsRepository(transactionContext)
}

func CreateUserRepository(options map[string]interface{}) (domain.UserRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewUserRepository(transactionContext)
}

func CreateCompanyRepository(options map[string]interface{}) (domain.CompanyRepository, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return repository.NewCompanyRepository(transactionContext)
}