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

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

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

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

// CreateUsersRepository 公司企业信息
func CreateCompanyRepository(options map[string]interface{}) (domain.CompanyRepository, error) {
	var transactionContext *transaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*transaction.TransactionContext)
	}
	return repository.NewCompanyRepository(transactionContext)
}

// CreatePartnerCategoryRepository 合伙人分类数据
func CreatePartnerCategoryRepository(options map[string]interface{}) (domain.PartnerCategoryRepository, error) {
	var transactionContext *transaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*transaction.TransactionContext)
	}
	return repository.NewPartnerCategoryRepository(transactionContext)
}

// CreateBusinessBonusRepository 业务分红
func CreateBusinessBonusRepository(options map[string]interface{}) (domain.BusinessBonusRepository, error) {
	var transactionContext *transaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*transaction.TransactionContext)
	}
	return repository.NewBusinessBonusRepository(transactionContext)
}