mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-04 21:55:48 +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 {
|
||||
|
||||
Reference in New Issue
Block a user