mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
fix: editor提示被遮挡问题修复等
This commit is contained in:
@@ -209,7 +209,7 @@ func (d *dbAppImpl) GetDbConnByInstanceId(ctx context.Context, instanceId uint64
|
||||
return nil, errorx.NewBiz("failed to get database list")
|
||||
}
|
||||
if len(dbs) == 0 {
|
||||
return nil, errorx.NewBiz("DB instance [%d] database is not configured, please configure it first", instanceId)
|
||||
return nil, errorx.NewBizf("DB instance [%d] database is not configured, please configure it first", instanceId)
|
||||
}
|
||||
|
||||
// 使用该实例关联的已配置数据库中的第一个库进行连接并返回
|
||||
@@ -308,7 +308,7 @@ func (d *dbAppImpl) DumpDb(ctx context.Context, reqParam *dto.DumpDb) error {
|
||||
}
|
||||
if len(tbs) <= 0 {
|
||||
log(fmt.Sprintf("failed to get table [%s] information: No table information was retrieved", tableName))
|
||||
return errorx.NewBiz("Failed to get table information: %s", tableName)
|
||||
return errorx.NewBizf("Failed to get table information: %s", tableName)
|
||||
}
|
||||
|
||||
tableInfo := tbs[0]
|
||||
|
||||
@@ -114,7 +114,7 @@ func (app *dataSyncAppImpl) Run(ctx context.Context, id uint64) error {
|
||||
}
|
||||
updateStateTask.Id = id
|
||||
if err := app.UpdateById(ctx, updateStateTask); err != nil {
|
||||
return errorx.NewBiz("failed to update task running state: %s", err.Error())
|
||||
return errorx.NewBizf("failed to update task running state: %s", err.Error())
|
||||
}
|
||||
|
||||
// 标记该任务运行中
|
||||
@@ -184,20 +184,20 @@ func (app *dataSyncAppImpl) doDataSync(ctx context.Context, sql string, task *en
|
||||
srcConn, err := app.dbApp.GetDbConn(ctx, uint64(task.SrcDbId), task.SrcDbName)
|
||||
|
||||
if err != nil {
|
||||
return errorx.NewBiz("failed to connect to the source database: %s", err.Error())
|
||||
return errorx.NewBizf("failed to connect to the source database: %s", err.Error())
|
||||
}
|
||||
|
||||
// 获取目标数据库连接
|
||||
targetConn, err := app.dbApp.GetDbConn(ctx, uint64(task.TargetDbId), task.TargetDbName)
|
||||
if err != nil {
|
||||
return errorx.NewBiz("failed to connect to the target database: %s", err.Error())
|
||||
return errorx.NewBizf("failed to connect to the target database: %s", err.Error())
|
||||
}
|
||||
|
||||
// task.FieldMap为json数组字符串 [{"src":"id","target":"id"}],转为map
|
||||
var fieldMap []map[string]string
|
||||
err = json.Unmarshal([]byte(task.FieldMap), &fieldMap)
|
||||
if err != nil {
|
||||
return errorx.NewBiz("there was an error parsing the field map json: %s", err.Error())
|
||||
return errorx.NewBizf("there was an error parsing the field map json: %s", err.Error())
|
||||
}
|
||||
|
||||
// 记录本次同步数据总数
|
||||
@@ -213,7 +213,7 @@ func (app *dataSyncAppImpl) doDataSync(ctx context.Context, sql string, task *en
|
||||
|
||||
targetTableColumns, err := targetConn.GetMetadata().GetColumns(task.TargetTableName)
|
||||
if err != nil {
|
||||
return errorx.NewBiz("failed to get target table columns: %s", err.Error())
|
||||
return errorx.NewBizf("failed to get target table columns: %s", err.Error())
|
||||
}
|
||||
targetColumnName2Column := collx.ArrayToMap(targetTableColumns, func(column dbi.Column) string {
|
||||
return column.ColumnName
|
||||
@@ -300,7 +300,7 @@ func (app *dataSyncAppImpl) srcData2TargetDb(srcRes []map[string]any, fieldMap [
|
||||
// 开启本批次执行事务
|
||||
targetDbTx, err := targetDbConn.Begin()
|
||||
if err != nil {
|
||||
return errorx.NewBiz("failed to start the target database transaction: %s", err.Error())
|
||||
return errorx.NewBizf("failed to start the target database transaction: %s", err.Error())
|
||||
}
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -320,7 +320,7 @@ func (app *dataSyncAppImpl) srcData2TargetDb(srcRes []map[string]any, fieldMap [
|
||||
// 如果是mssql,暂不手动提交事务,否则报错 mssql: The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
|
||||
if err := targetDbTx.Commit(); err != nil {
|
||||
if targetDbConn.Info.Type != dbi.ToDbType("mssql") {
|
||||
return errorx.NewBiz("data synchronization - The target database transaction failed to commit: %s", err.Error())
|
||||
return errorx.NewBizf("data synchronization - The target database transaction failed to commit: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ func (d *dbSqlExecAppImpl) FlowBizHandle(ctx context.Context, bizHandleParam *fl
|
||||
|
||||
execSqlBizForm, err := jsonx.To[*FlowDbExecSqlBizForm](procinst.BizForm)
|
||||
if err != nil {
|
||||
return nil, errorx.NewBiz("failed to parse the business form information: %s", err.Error())
|
||||
return nil, errorx.NewBizf("failed to parse the business form information: %s", err.Error())
|
||||
}
|
||||
|
||||
dbConn, err := d.dbApp.GetDbConn(ctx, execSqlBizForm.DbId, execSqlBizForm.DbName)
|
||||
@@ -471,7 +471,7 @@ func (d *dbSqlExecAppImpl) doUpdate(ctx context.Context, sqlExecParam *sqlExecPa
|
||||
nowRec++
|
||||
res = append(res, row)
|
||||
if nowRec == maxRec {
|
||||
return errorx.NewBiz("update SQL - the maximum number of updated queries is exceeded: %d", maxRec)
|
||||
return errorx.NewBizf("update SQL - the maximum number of updated queries is exceeded: %d", maxRec)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -122,12 +122,12 @@ func (app *dbTransferAppImpl) InitCronJob() {
|
||||
|
||||
func (app *dbTransferAppImpl) Run(ctx context.Context, taskId uint64) (uint64, error) {
|
||||
if app.IsRunning(taskId) {
|
||||
return 0, errorx.NewBiz("the db transfer task [%d] is running, please do not repeat the operation", taskId)
|
||||
return 0, errorx.NewBizf("the db transfer task [%d] is running, please do not repeat the operation", taskId)
|
||||
}
|
||||
|
||||
task, err := app.GetById(taskId)
|
||||
if err != nil {
|
||||
return 0, errorx.NewBiz("db transfer task [%d] not found", taskId)
|
||||
return 0, errorx.NewBizf("db transfer task [%d] not found", taskId)
|
||||
}
|
||||
|
||||
logId, _ := app.CreateLog(ctx, taskId)
|
||||
|
||||
@@ -70,13 +70,13 @@ func (di *DbInfo) Conn(ctx context.Context, meta Meta) (*DbConn, error) {
|
||||
conn, err := meta.GetSqlDb(ctx, di)
|
||||
if err != nil {
|
||||
logx.Errorf("db connection failed: %s:%d/%s, err:%s", di.Host, di.Port, database, err.Error())
|
||||
return nil, errorx.NewBiz("db connection failed: %s", err.Error())
|
||||
return nil, errorx.NewBizf("db connection failed: %s", err.Error())
|
||||
}
|
||||
|
||||
err = conn.Ping()
|
||||
if err != nil {
|
||||
logx.Errorf("db ping failed: %s:%d/%s, err:%s", di.Host, di.Port, database, err.Error())
|
||||
return nil, errorx.NewBiz("db connection failed: %s", err.Error())
|
||||
return nil, errorx.NewBizf("db connection failed: %s", err.Error())
|
||||
}
|
||||
|
||||
dbc := &DbConn{Id: GetDbConnId(di.Id, database), Info: di}
|
||||
|
||||
@@ -134,7 +134,7 @@ func (dd *DMMetadata) GetPrimaryKey(tablename string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
if len(columns) == 0 {
|
||||
return "", errorx.NewBiz("[%s] 表不存在", tablename)
|
||||
return "", errorx.NewBizf("[%s] 表不存在", tablename)
|
||||
}
|
||||
for _, v := range columns {
|
||||
if v.IsPrimaryKey {
|
||||
|
||||
@@ -129,7 +129,7 @@ func (md *MssqlMetadata) GetPrimaryKey(tablename string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
if len(columns) == 0 {
|
||||
return "", errorx.NewBiz("[%s] 表不存在", tablename)
|
||||
return "", errorx.NewBizf("[%s] 表不存在", tablename)
|
||||
}
|
||||
|
||||
for _, v := range columns {
|
||||
|
||||
@@ -125,7 +125,7 @@ func (md *MysqlMetadata) GetPrimaryKey(tablename string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
if len(columns) == 0 {
|
||||
return "", errorx.NewBiz("[%s] 表不存在", tablename)
|
||||
return "", errorx.NewBizf("[%s] 表不存在", tablename)
|
||||
}
|
||||
|
||||
for _, v := range columns {
|
||||
|
||||
@@ -148,7 +148,7 @@ func (od *OracleMetadata) GetPrimaryKey(tablename string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
if len(columns) == 0 {
|
||||
return "", errorx.NewBiz("[%s] 表不存在", tablename)
|
||||
return "", errorx.NewBizf("[%s] 表不存在", tablename)
|
||||
}
|
||||
for _, v := range columns {
|
||||
if v.IsPrimaryKey {
|
||||
|
||||
@@ -124,7 +124,7 @@ func (pd *PgsqlMetadata) GetPrimaryKey(tablename string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
if len(columns) == 0 {
|
||||
return "", errorx.NewBiz("[%s] 表不存在", tablename)
|
||||
return "", errorx.NewBizf("[%s] 表不存在", tablename)
|
||||
}
|
||||
for _, v := range columns {
|
||||
if v.IsPrimaryKey {
|
||||
|
||||
@@ -148,14 +148,14 @@ func (d *Container) ContainerCreate(rc *req.Ctx) {
|
||||
|
||||
if err != nil {
|
||||
_ = cli.DockerClient.ContainerRemove(ctx, containerCreate.Name, container.RemoveOptions{RemoveVolumes: true, Force: true})
|
||||
panic(errorx.NewBiz("create container failed, err: %v", err))
|
||||
panic(errorx.NewBizf("create container failed, err: %v", err))
|
||||
}
|
||||
|
||||
logx.Infof("create container %s successful! now check if the container is started and delete the container information if it is not.", containerCreate.Name)
|
||||
|
||||
if err := cli.DockerClient.ContainerStart(ctx, con.ID, container.StartOptions{}); err != nil {
|
||||
_ = cli.DockerClient.ContainerRemove(ctx, containerCreate.Name, container.RemoveOptions{RemoveVolumes: true, Force: true})
|
||||
panic(errorx.NewBiz("create successful but start failed, err: %v", err))
|
||||
panic(errorx.NewBizf("create successful but start failed, err: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,14 +58,14 @@ func (di *EsInfo) Conn(ctx context.Context) (*EsConn, map[string]any, error) {
|
||||
err := di.IfUseSshTunnelChangeIpPort(ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("es ssh failed: %s, err:%s", di.baseUrl, err.Error())
|
||||
return nil, nil, errorx.NewBiz("es ssh failed: %s", err.Error())
|
||||
return nil, nil, errorx.NewBizf("es ssh failed: %s", err.Error())
|
||||
}
|
||||
|
||||
// 尝试获取es版本信息,调用接口:get /
|
||||
res, err := di.Ping()
|
||||
if err != nil {
|
||||
logx.Errorf("es ping failed: %s, err:%s", di.baseUrl, err.Error())
|
||||
return nil, nil, errorx.NewBiz("es ping failed: %s", err.Error())
|
||||
return nil, nil, errorx.NewBizf("es ping failed: %s", err.Error())
|
||||
}
|
||||
|
||||
esc := &EsConn{Id: di.InstanceId, Info: di}
|
||||
@@ -111,7 +111,7 @@ func (di *EsInfo) ExecApi(method, path string, data any, timeoutSecond ...int) (
|
||||
return request.PutObj(data).BodyToMap()
|
||||
}
|
||||
|
||||
return nil, errorx.NewBiz("不支持的请求方法: %s", method)
|
||||
return nil, errorx.NewBizf("不支持的请求方法: %s", method)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -312,10 +312,10 @@ func (m *machineAppImpl) ToMachineInfoById(machineId uint64) (*mcm.MachineInfo,
|
||||
func (m *machineAppImpl) getMachineAndAuthCert(machineId uint64) (*entity.Machine, *tagentity.ResourceAuthCert, error) {
|
||||
me, err := m.GetById(machineId)
|
||||
if err != nil {
|
||||
return nil, nil, errorx.NewBiz("[%d] machine not found", machineId)
|
||||
return nil, nil, errorx.NewBizf("[%d] machine not found", machineId)
|
||||
}
|
||||
if me.Status != entity.MachineStatusEnable && me.Protocol == 1 {
|
||||
return nil, nil, errorx.NewBiz("[%s] machine has been disable", me.Code)
|
||||
return nil, nil, errorx.NewBizf("[%s] machine has been disable", me.Code)
|
||||
}
|
||||
|
||||
authCert, err := m.resourceAuthCertApp.GetResourceAuthCert(tagentity.TagTypeMachine, me.Code)
|
||||
|
||||
@@ -180,7 +180,7 @@ func (m *machineFileAppImpl) GetDirSize(ctx context.Context, opParam *dto.Machin
|
||||
//du: cannot access ‘/proc/19087/fdinfo/3’: No such file or directory\n
|
||||
//18G /\n
|
||||
if res == "" {
|
||||
return "", errorx.NewBiz("failed to get directory size: %s", err.Error())
|
||||
return "", errorx.NewBizf("failed to get directory size: %s", err.Error())
|
||||
}
|
||||
strs := strings.Split(res, "\n")
|
||||
res = strs[len(strs)-2]
|
||||
@@ -247,7 +247,7 @@ func (m *machineFileAppImpl) CreateFile(ctx context.Context, opParam *dto.Machin
|
||||
}
|
||||
file, err := sftpCli.Create(path)
|
||||
if err != nil {
|
||||
return nil, errorx.NewBiz("failed to create file: %s", err.Error())
|
||||
return nil, errorx.NewBizf("failed to create file: %s", err.Error())
|
||||
}
|
||||
defer file.Close()
|
||||
return mi, err
|
||||
|
||||
@@ -63,7 +63,7 @@ func (m *machineTermOpAppImpl) TermConn(ctx context.Context, cli *mcm.Cli, wsCon
|
||||
|
||||
fileKey, wc, saveFileFunc, err := m.fileApp.NewWriter(ctx, "", fmt.Sprintf("mto_%d_%s.cast", termOpRecord.MachineId, timex.TimeNo()))
|
||||
if err != nil {
|
||||
return errorx.NewBiz("failed to create a terminal playback log file: %v", err)
|
||||
return errorx.NewBizf("failed to create a terminal playback log file: %v", err)
|
||||
}
|
||||
defer saveFileFunc(&err)
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ func (c *Cli) GetSftpCli() (*sftp.Client, error) {
|
||||
if sftpclient == nil {
|
||||
sc, serr := sftp.NewClient(c.sshClient)
|
||||
if serr != nil {
|
||||
return nil, errorx.NewBiz("failed to obtain the sftp client: %s", serr.Error())
|
||||
return nil, errorx.NewBizf("failed to obtain the sftp client: %s", serr.Error())
|
||||
}
|
||||
sftpclient = sc
|
||||
c.sftpClient = sftpclient
|
||||
|
||||
@@ -56,7 +56,7 @@ func (mi *MachineInfo) Conn(ctx context.Context) (*Cli, error) {
|
||||
// 如果使用了ssh隧道,则修改机器ip port为暴露的ip port
|
||||
err := mi.IfUseSshTunnelChangeIpPort(ctx, false)
|
||||
if err != nil {
|
||||
return nil, errorx.NewBiz("ssh tunnel connection failed: %s", err.Error())
|
||||
return nil, errorx.NewBizf("ssh tunnel connection failed: %s", err.Error())
|
||||
}
|
||||
|
||||
cli := &Cli{Info: mi}
|
||||
|
||||
@@ -254,7 +254,7 @@ func (r *redisAppImpl) FlowBizHandle(ctx context.Context, bizHandleParam *flowap
|
||||
|
||||
runCmdParam, err := jsonx.To[*FlowRedisRunCmdBizForm](procinst.BizForm)
|
||||
if err != nil {
|
||||
return nil, errorx.NewBiz("failed to parse the business form information: %s", err.Error())
|
||||
return nil, errorx.NewBizf("failed to parse the business form information: %s", err.Error())
|
||||
}
|
||||
|
||||
redisConn, err := r.GetRedisConn(ctx, runCmdParam.Id, runCmdParam.Db)
|
||||
|
||||
@@ -70,7 +70,7 @@ func (re *RedisInfo) connStandalone() (*RedisConn, error) {
|
||||
_, e := cli.Ping(context.Background()).Result()
|
||||
if e != nil {
|
||||
cli.Close()
|
||||
return nil, errorx.NewBiz("redis standalone connection failed: %s", e.Error())
|
||||
return nil, errorx.NewBizf("redis standalone connection failed: %s", e.Error())
|
||||
}
|
||||
|
||||
logx.Infof("redis standalone connection: %s/%d", re.Host, re.Db)
|
||||
@@ -95,7 +95,7 @@ func (re *RedisInfo) connCluster() (*RedisConn, error) {
|
||||
_, e := cli.Ping(context.Background()).Result()
|
||||
if e != nil {
|
||||
cli.Close()
|
||||
return nil, errorx.NewBiz("redis cluster connection failed: %s", e.Error())
|
||||
return nil, errorx.NewBizf("redis cluster connection failed: %s", e.Error())
|
||||
}
|
||||
|
||||
logx.Infof("redis cluster connection: %s/%d", re.Host, re.Db)
|
||||
@@ -128,7 +128,7 @@ func (re *RedisInfo) connSentinel() (*RedisConn, error) {
|
||||
_, e := cli.Ping(context.Background()).Result()
|
||||
if e != nil {
|
||||
cli.Close()
|
||||
return nil, errorx.NewBiz("redis sentinel connection failed: %s", e.Error())
|
||||
return nil, errorx.NewBizf("redis sentinel connection failed: %s", e.Error())
|
||||
}
|
||||
|
||||
logx.Infof("redis sentinel connection: %s/%d", re.Host, re.Db)
|
||||
|
||||
@@ -121,7 +121,7 @@ func (r *resourceAuthCertAppImpl) RelateAuthCert(ctx context.Context, params *dt
|
||||
|
||||
existNameAc := &entity.ResourceAuthCert{Name: addAcName}
|
||||
if r.GetByCond(existNameAc) == nil && existNameAc.ResourceCode != resourceCode {
|
||||
return errorx.NewBiz("The name of the authorization credential cannot be repeated: [%s]", addAcName)
|
||||
return errorx.NewBizf("The name of the authorization credential cannot be repeated: [%s]", addAcName)
|
||||
}
|
||||
|
||||
addAuthCerts = append(addAuthCerts, addAc)
|
||||
|
||||
@@ -210,7 +210,7 @@ func (p *tagTreeAppImpl) RelateTagsByCodeAndType(ctx context.Context, param *dto
|
||||
|
||||
if len(parentTagCodePaths) == 0 {
|
||||
// 不满足满足条件的标签
|
||||
return errorx.NewBiz("There is no tag that satisfies [type=%d, code=%s]", parentTagType, parentTagCode)
|
||||
return errorx.NewBizf("There is no tag that satisfies [type=%d, code=%s]", parentTagType, parentTagCode)
|
||||
}
|
||||
|
||||
for _, tag := range param.Tags {
|
||||
|
||||
Reference in New Issue
Block a user