domain_service.go 3.0 KB
package factory

import (
	"github.com/linmadan/egglib-go/core/application"
	"github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain/bytecore"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/domainService"
)

func FastLog(transactionContext application.TransactionContext, logType domain.LogType, sourceId int, logEntry domainService.Log) error {
	logService, _ := domainService.NewPGLogService(transactionContext.(*pg.TransactionContext))
	return logService.Log(logType, sourceId, logEntry)
}

func CreateLoadDataTableService(transactionContext application.TransactionContext) (domain.PreviewDataTableService, error) {
	return domainService.NewLoadDataTableService(transactionContext.(*pg.TransactionContext))
}

func CreateEditDataTableService(transactionContext application.TransactionContext) (domain.EditDataTableService, error) {
	return domainService.NewEditDataTableService(transactionContext.(*pg.TransactionContext))
}

func CreateFlushDataTableService(transactionContext application.TransactionContext) (domain.FlushDataTableService, error) {
	return domainService.NewFlushDataTableService(transactionContext.(*pg.TransactionContext))
}

func CreateDeleteFileService(transactionContext application.TransactionContext) (domain.DeleteFileService, error) {
	return domainService.NewDeleteFileService(transactionContext.(*pg.TransactionContext))
}

func CreateGenerateMainTableService(transactionContext application.TransactionContext) (domain.GenerateMainTableService, error) {
	return domainService.NewGenerateMainTableService(transactionContext.(*pg.TransactionContext))
}

func CreateCopyDataTableService(transactionContext application.TransactionContext) (domain.CopyDataTableService, error) {
	return domainService.NewCopyDataTableService(transactionContext.(*pg.TransactionContext))
}

func CreateDeleteDataTableService(transactionContext application.TransactionContext) (domain.DeleteDataTableService, error) {
	return domainService.NewDeleteDataTableService(transactionContext.(*pg.TransactionContext))
}

func CreateUpdateTableStructService(transactionContext application.TransactionContext) (domain.UpdateTableStructService, error) {
	return domainService.NewUpdateTableStructService(transactionContext.(*pg.TransactionContext))
}

func CreateAddTableStructService(transactionContext application.TransactionContext) (domain.AddTableStructService, error) {
	return domainService.NewAddTableStructService(transactionContext.(*pg.TransactionContext))
}

func CreateAppendDataToTableService(transactionContext application.TransactionContext) (domain.AppendDataToTableService, error) {
	return domainService.NewAppendDataToTableService(transactionContext.(*pg.TransactionContext))
}

// 字库核心
func CreateByteCoreService(transactionContext application.TransactionContext) (bytecore.ByteLibService, error) {
	return domainService.ByteCore, nil
}