repository.go 1.8 KB
package factory

import (
	"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
	"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
	"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/repository"
)

//CreatePartnerInfoRepository 合伙人信息
func CreatePartnerInfoRepository(options map[string]interface{}) (domain.PartnerInfoRepository, error) {
	var transactionContext *transaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*transaction.TransactionContext)
	}
	return repository.NewPartnerInfoRepository(transactionContext)
}

//CreateAdminUserRepository 管理员信息
func CreateAdminUserRepository(options map[string]interface{}) (domain.AdminUserRepository, error) {
	var transactionContext *transaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*transaction.TransactionContext)
	}
	return repository.NewAdminUserRepository(transactionContext)
}

//CreateAdminUserRepository 管理员权限信息
func CreateAdminPermissionRepository(options map[string]interface{}) (domain.AdminPermissionRepository, error) {
	var transactionContext *transaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*transaction.TransactionContext)
	}
	return repository.NewAdminPermissionRepository(transactionContext)
}

//CreatePartnerInfoRepository 合伙人信息
func CreateOrderPaymentRepository(options map[string]interface{}) (domain.OrderPaymentRepository, error) {
	var transactionContext *transaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*transaction.TransactionContext)
	}
	return repository.NewOrderPaymentRepository(transactionContext)
}