repository.go 2.1 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)
}

//CreateOrderPaymentRepository 分红单信息
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)
}

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