fast.go 822 字节
package factory

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

func FastError(err error) error {
	return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}

func FastDataTable(options starrocks.QueryOptions) (*domain.DataTable, error) {
	var err error
	// 待优化分批下载,压缩
	var dataTable *domain.DataTable
	dataTable, err = starrocks.Query(options, starrocks.WrapQueryFuncWithDB(starrocks.DB))
	if err != nil {
		return nil, err
	}

	dataTable.Total, err = starrocks.WrapQueryCountWithDB(options, starrocks.DB)()
	if err != nil {
		return nil, err
	}
	return dataTable, nil
}