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