-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dataManger module, support mysql data migrate
- Loading branch information
liuxinwang
committed
Dec 8, 2023
1 parent
17606f7
commit e7674d6
Showing
11 changed files
with
633 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package handler | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"horizon/service" | ||
) | ||
|
||
func DataMigrateJobGet(c *gin.Context) { | ||
service.DataMigrateJobSelectByList(c) | ||
} | ||
|
||
func DataMigrateJobIdGet(c *gin.Context) { | ||
service.DataMigrateJobSelectById(c) | ||
} | ||
|
||
func DataMigrateJobPost(c *gin.Context) { | ||
service.DataMigrateJobInsert(c) | ||
} | ||
|
||
func DataMigrateJobExecutePost(c *gin.Context) { | ||
service.DataMigrateJobExecuteUpdate(c) | ||
} | ||
|
||
func DataMigrateJobDetailGet(c *gin.Context) { | ||
service.DataMigrateJobDetailSelectByList(c) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package model | ||
|
||
import "time" | ||
|
||
type DataMigrateJob struct { | ||
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"` | ||
Name string `gorm:"type:varchar(50);not null;comment:任务名称" json:"name"` | ||
Describe string `gorm:"type:varchar(255);not null;comment:描述" json:"describe"` | ||
SourceInstId string `gorm:"type:varchar(20);not null;comment:源实例ID" json:"sourceInstId"` | ||
SourceDb string `gorm:"type:varchar(20);not null;comment:源数据库" json:"sourceDb"` | ||
TargetInstId string `gorm:"type:varchar(20);not null;comment:目的实例ID" json:"targetInstId"` | ||
TargetDb string `gorm:"type:varchar(20);not null;comment:目的数据库" json:"targetDb"` | ||
Status string `gorm:"type:enum('NotStart', 'Running', 'Error', 'Finished');default:'NotStart';not null;comment:任务状态" json:"status"` | ||
CreatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp;comment:创建时间" json:"createdAt"` | ||
UpdatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp;comment:修改时间" json:"updatedAt"` | ||
} | ||
|
||
type DataMigrateJobDetail struct { | ||
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"` | ||
DataMigrateJobId uint `gorm:"type:int;comment:迁移任务主键ID" json:"dataMigrateJobId"` | ||
TableName string `gorm:"type:varchar(50);not null;comment:表名称" json:"tableName"` | ||
Status string `gorm:"type:enum('NotStart', 'Running', 'Error', 'Finished');default:'NotStart';not null;comment:同步状态" json:"status"` | ||
EstimateRows uint `gorm:"type:int;comment:预估行数" json:"estimateRows"` | ||
CompletedRows uint `gorm:"type:int;comment:已完成行数" json:"completedRows"` | ||
ErrorMsg string `gorm:"type:varchar(1000);not null;comment:错误信息" json:"errorMsg"` | ||
CreatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp;comment:创建时间" json:"createdAt"` | ||
UpdatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp;comment:修改时间" json:"updatedAt"` | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.