Documentation ¶
Index ¶
- Variables
- func CreateTaskChangeLog(ctx *common.Context, task *models.Task, user, content string)
- func NewClusterDriver(c *ClusterService) cluster.ClusterDriver
- func NewClusterSynchronizer(c *ClusterService) cluster.ClusterSynchronizer
- type ClusterService
- func (c *ClusterService) CheckParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *ClusterService) CheckUpdateParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *ClusterService) CreateCluster(ctx *gin.Context) (common.ServiceCode, error)
- func (c *ClusterService) DeleteCluster(ctx *gin.Context) (common.ServiceCode, error)
- func (c *ClusterService) GetClusterDatabase(ctx *gin.Context) ([]string, common.ServiceCode, error)
- func (c *ClusterService) GetClusterTables(ctx *gin.Context, database string) ([]string, common.ServiceCode, error)
- func (c *ClusterService) ModelToService(m *models.Cluster) *ClusterService
- func (c *ClusterService) QueryCluster(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
- func (_ *ClusterService) RefreshClusterBigTables(ctx *gin.Context) (common.ServiceCode, error)
- func (c *ClusterService) ServiceToModel() *models.Cluster
- func (c *ClusterService) SyncCluster(ctx *gin.Context) (common.ServiceCode, error)
- func (c *ClusterService) UpdateCluster(ctx *gin.Context) (common.ServiceCode, error)
- type ClusterStatistic
- type ClusterStatisticDetail
- type ConfigService
- func (c *ConfigService) GetConfig(ctx *gin.Context) (*ConfigService, common.ServiceCode, error)
- func (c *ConfigService) ModelToService(m *models.Config) *ConfigService
- func (_ *ConfigService) ReloadConfig(ctx *gin.Context)
- func (c *ConfigService) ServiceToModel() *models.Config
- func (c *ConfigService) UpdateConfig(ctx *gin.Context) (*ConfigService, common.ServiceCode, error)
- type ConnService
- func (c *ConnService) CheckParameters(_ *gin.Context) (bool, common.ServiceCode, error)
- func (c *ConnService) CreateConn(ctx *gin.Context) (common.ServiceCode, error)
- func (c *ConnService) DeleteConn(ctx *gin.Context) (common.ServiceCode, error)
- func (c *ConnService) ModelToService(m *models.Connection) *ConnService
- func (c *ConnService) QueryConn(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
- func (c *ConnService) ServiceToModel() *models.Connection
- func (c *ConnService) TestConn(ctx *gin.Context) (common.ServiceCode, error)
- func (c *ConnService) UpdateConn(ctx *gin.Context) (common.ServiceCode, error)
- type DestService
- func (c *DestService) CheckParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *DestService) CheckUpdateParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *DestService) CreateDest(ctx *gin.Context) (common.ServiceCode, error)
- func (c *DestService) DeleteDest(ctx *gin.Context) (common.ServiceCode, error)
- func (c *DestService) DestDatabaseExist(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *DestService) DestTableExist(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *DestService) ModelToService(m *models.Destination) *DestService
- func (c *DestService) QueryDest(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
- func (c *DestService) ServiceToModel() *models.Destination
- func (c *DestService) UpdateDest(ctx *gin.Context) (common.ServiceCode, error)
- type Model
- type PolicyRevisionService
- func (c *PolicyRevisionService) CreatePolicyRevision(ctx *gin.Context, old, new *models.Policy) (common.ServiceCode, error)
- func (c *PolicyRevisionService) ModelToService(m *models.PolicyRevision) *PolicyRevisionService
- func (c *PolicyRevisionService) QueryPolicyRevision(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
- func (c *PolicyRevisionService) ServiceToModel() *models.PolicyRevision
- type PolicyService
- func (c *PolicyService) CheckParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *PolicyService) CheckUpdateParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *PolicyService) CreatePolicy(ctx *gin.Context) (common.ServiceCode, error)
- func (c *PolicyService) DeletePolicy(ctx *gin.Context) (common.ServiceCode, error)
- func (c *PolicyService) ModelToService(m *models.Policy) *PolicyService
- func (c *PolicyService) QueryPolicy(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
- func (c *PolicyService) ServiceToModel() *models.Policy
- func (c *PolicyService) UpdatePolicy(ctx *gin.Context) (common.ServiceCode, error)
- type PolicyStatistic
- type PolicyStatisticDetail
- type SourceService
- func (c *SourceService) CheckParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *SourceService) CreateSource(ctx *gin.Context) (common.ServiceCode, error)
- func (c *SourceService) DeleteSource(ctx *gin.Context) (common.ServiceCode, error)
- func (c *SourceService) ModelToService(m *models.Source) *SourceService
- func (c *SourceService) QuerySource(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
- func (c *SourceService) ServiceToModel() *models.Source
- func (c *SourceService) UpdateSource(ctx *gin.Context) (common.ServiceCode, error)
- type StatisticDetail
- type Task
- type TaskChangeLogService
- type TaskPlanService
- type TaskRevisionService
- func (c *TaskRevisionService) CreateTaskRevision(ctx *gin.Context, old, new *models.Task) (common.ServiceCode, error)
- func (c *TaskRevisionService) ModelToService(m *models.TaskRevision) *TaskRevisionService
- func (c *TaskRevisionService) QueryTaskRevision(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
- func (c *TaskRevisionService) ServiceToModel() *models.TaskRevision
- type TaskService
- func (c *TaskService) CheckUpdateParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
- func (c *TaskService) DeleteTask(ctx *gin.Context) (common.ServiceCode, error)
- func (c *TaskService) ModelToService(m *models.Task) *TaskService
- func (c *TaskService) QueryTask(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
- func (c *TaskService) ServiceToModel() *models.Task
- func (c *TaskService) UpdateTask(ctx *gin.Context) (common.ServiceCode, error)
- type TaskStatisticDetail
- type TaskStatisticService
- type UserService
- func (c *UserService) DeleteUser(ctx *gin.Context) (*UserService, common.ServiceCode, error)
- func (c *UserService) ModelToService(m *models.User) *UserService
- func (c *UserService) ModifyUserInfo(ctx *gin.Context) (*UserService, common.ServiceCode, error)
- func (c *UserService) QueryUsers(ctx *gin.Context) (any, common.ServiceCode, error)
- func (c *UserService) RegisterUser(ctx *gin.Context) (*UserService, common.ServiceCode, error)
- func (c *UserService) ServiceToModel() *models.User
- func (c *UserService) UserLogin(ctx *gin.Context) (*UserService, common.ServiceCode, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Cfg = &ConfigService{}
View Source
var RefreshClusterBigTablesLock sync.Mutex
Functions ¶
func CreateTaskChangeLog ¶
func NewClusterDriver ¶
func NewClusterDriver(c *ClusterService) cluster.ClusterDriver
func NewClusterSynchronizer ¶
func NewClusterSynchronizer(c *ClusterService) cluster.ClusterSynchronizer
Types ¶
type ClusterService ¶
type ClusterService struct { Model ClusterID string `json:"cluster_id"` // 集群ID ClusterName string `json:"cluster_name"` // 集群名称 Description string `json:"description"` // 说明 Bu string `json:"bu"` // bu Env string `json:"env"` // 环境 ImportFrom common.ClusterImportFromType `json:"import_from"` // 添加方式:customized:自定义添加 ipaas:从资源中心导入 ClusterType common.ClusterType `json:"cluster_type"` // 集群类型(mysql, 其他的) ServiceAddr string `json:"service_addr"` // 服务地址(vip) ip:port WriteAddr string `json:"write_addr"` // 写库地址 ip:port ReadAddr string `json:"read_addr"` // 读库地址 ip:port UserName string `json:"user_name"` // 用户名(若未提供用户名和密码则以全局的为准) Password string `json:"password"` // 密码 }
func GetClusterServiceByClusterID ¶
func GetClusterServiceByClusterID(ctx *gin.Context, clusterID string) (*ClusterService, error)
func (*ClusterService) CheckParameters ¶
func (c *ClusterService) CheckParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*ClusterService) CheckUpdateParameters ¶
func (c *ClusterService) CheckUpdateParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*ClusterService) CreateCluster ¶
func (c *ClusterService) CreateCluster(ctx *gin.Context) (common.ServiceCode, error)
func (*ClusterService) DeleteCluster ¶
func (c *ClusterService) DeleteCluster(ctx *gin.Context) (common.ServiceCode, error)
func (*ClusterService) GetClusterDatabase ¶
func (c *ClusterService) GetClusterDatabase(ctx *gin.Context) ([]string, common.ServiceCode, error)
func (*ClusterService) GetClusterTables ¶
func (c *ClusterService) GetClusterTables(ctx *gin.Context, database string) ([]string, common.ServiceCode, error)
func (*ClusterService) ModelToService ¶
func (c *ClusterService) ModelToService(m *models.Cluster) *ClusterService
func (*ClusterService) QueryCluster ¶
func (c *ClusterService) QueryCluster(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
func (*ClusterService) RefreshClusterBigTables ¶
func (_ *ClusterService) RefreshClusterBigTables(ctx *gin.Context) (common.ServiceCode, error)
func (*ClusterService) ServiceToModel ¶
func (c *ClusterService) ServiceToModel() *models.Cluster
func (*ClusterService) SyncCluster ¶
func (c *ClusterService) SyncCluster(ctx *gin.Context) (common.ServiceCode, error)
func (*ClusterService) UpdateCluster ¶
func (c *ClusterService) UpdateCluster(ctx *gin.Context) (common.ServiceCode, error)
type ClusterStatistic ¶
type ClusterStatistic struct { StartDate string `json:"start_date"` EndDate string `json:"end_date"` StartSize string `json:"start_size"` EndSize string `json:"end_size"` Total int `json:"total"` Data []ClusterStatisticDetail `json:"data"` }
ClusterStatistic 集群的大表统计信息
func (*ClusterStatistic) ClusterStatisticDetail ¶
func (c *ClusterStatistic) ClusterStatisticDetail(ctx *gin.Context, groupBy string, queryMap map[string]string) (any, common.ServiceCode, error)
type ClusterStatisticDetail ¶
type ClusterStatisticDetail struct { Date string `json:"date"` // 统计的日期 Bu string `json:"bu"` // bu ClusterID string `json:"cluster_id"` // 集群ID ClusterName string `json:"cluster_name"` // 集群名称 Database string `json:"database"` // 库名 Table string `json:"table"` // 表名 TableSize int `json:"table_size"` // 表大小(GB) BigTableSizeSum int `json:"big_table_size_sum"` // 本BU大表的总容量(GB) TableSizeSum int `json:"table_size_sum"` // 筛选的表的总容量(GB) TablesNum int `json:"tables_num"` // 大表个数 PoliciesNum int `json:"policies_num"` // 策略个数 Policies string `json:"policies"` // 对应的策略 }
ClusterStatisticDetail 大表统计信息
type ConfigService ¶
type ConfigService struct { ClusterDefaultUser string `json:"cluster_default_user"` // 源端用户名 ClusterDefaultPasswd string `json:"cluster_default_passwd"` // 源端密码 ClusterExcludeDatabase string `json:"cluster_exclude_database"` // 源端库黑名单 ClusterExcludeTables string `json:"cluster_exclude_tables"` // 源端表黑名单 TaskMaxParallel int `json:"task_max_parallel"` // 任务的最大并法数 TaskTimeout int `json:"task_timeout"` // 任务的超时时间 TaskConflictLevel common.TaskConflictLevelType `json:"task_conflict_level"` // 任务冲突级别:源端集群级别,库级别,表级别 TaskConflictMax int `json:"task_conflict_max"` // 最多允许运行几个任务 WorkflowRetentionDays int `json:"workflow_retention_days"` // 任务的工作流保留天数 ThanosUrl string `json:"thanos_url"` // 监控指标地址 SourceStatusDetect bool `json:"source_status_detect"` // 源端库运行状态检测 SourceStatusDetectDiskUsage int `json:"source_status_detect_disk_usage"` // 源端磁盘使用率 // 通知相关 Notice common.NoticeType `json:"notice"` EmailHost string `json:"email_host"` EmailPort int `json:"email_port"` EmailUsername string `json:"email_username"` EmailPassword string `json:"email_password"` EmailInsecureSkipVerify bool `json:"email_insecure_skip_verify"` }
func (*ConfigService) GetConfig ¶
func (c *ConfigService) GetConfig(ctx *gin.Context) (*ConfigService, common.ServiceCode, error)
GetConfig 查询配置
func (*ConfigService) ModelToService ¶
func (c *ConfigService) ModelToService(m *models.Config) *ConfigService
func (*ConfigService) ReloadConfig ¶
func (_ *ConfigService) ReloadConfig(ctx *gin.Context)
func (*ConfigService) ServiceToModel ¶
func (c *ConfigService) ServiceToModel() *models.Config
func (*ConfigService) UpdateConfig ¶
func (c *ConfigService) UpdateConfig(ctx *gin.Context) (*ConfigService, common.ServiceCode, error)
UpdateConfig 更新配置
type ConnService ¶
type ConnService struct { Model Name string `json:"name"` // 连接名称 Description string `json:"description"` // 说明 Bu string `json:"bu"` // 资产BU Storage common.StorageType `json:"storage"` // 归档介质 DataBendAddr string `json:"data_bend_addr"` // DataBend的AK DataBendAK string `json:"data_bend_ak"` // DataBend的SK DataBendSK string `json:"data_bend_sk"` // DataBend地址 MysqlHost string `json:"mysql_host"` // mysql地址 MysqlPort string `json:"mysql_port"` // mysql端口 MysqlUser string `json:"mysql_user"` // mysql用户名 MysqlPasswd string `json:"mysql_passwd"` // mysql密码 }
func (*ConnService) CheckParameters ¶
func (c *ConnService) CheckParameters(_ *gin.Context) (bool, common.ServiceCode, error)
func (*ConnService) CreateConn ¶
func (c *ConnService) CreateConn(ctx *gin.Context) (common.ServiceCode, error)
func (*ConnService) DeleteConn ¶
func (c *ConnService) DeleteConn(ctx *gin.Context) (common.ServiceCode, error)
func (*ConnService) ModelToService ¶
func (c *ConnService) ModelToService(m *models.Connection) *ConnService
func (*ConnService) QueryConn ¶
func (c *ConnService) QueryConn(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
func (*ConnService) ServiceToModel ¶
func (c *ConnService) ServiceToModel() *models.Connection
func (*ConnService) TestConn ¶
func (c *ConnService) TestConn(ctx *gin.Context) (common.ServiceCode, error)
TestConn 测试连接信息是否正确(校验地址和用户名密码)
func (*ConnService) UpdateConn ¶
func (c *ConnService) UpdateConn(ctx *gin.Context) (common.ServiceCode, error)
type DestService ¶
type DestService struct { Model Name string `json:"name"` // 目标端名称 Description string `json:"description"` // 说明 Storage common.StorageType `json:"storage"` // 归档介质 ConnectionID uint `json:"connection_id"` // 归档库连接信息 DatabaseName string `json:"database_name"` // 归档库名 TableName string `json:"table_name" example:"{source_table},table123_{YYYY-MM},{source_table}_{YYYY-MM}"` // 归档表名 Compress bool `json:"compress"` // 是否压缩存储 }
func (*DestService) CheckParameters ¶
func (c *DestService) CheckParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*DestService) CheckUpdateParameters ¶
func (c *DestService) CheckUpdateParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*DestService) CreateDest ¶
func (c *DestService) CreateDest(ctx *gin.Context) (common.ServiceCode, error)
func (*DestService) DeleteDest ¶
func (c *DestService) DeleteDest(ctx *gin.Context) (common.ServiceCode, error)
func (*DestService) DestDatabaseExist ¶
func (c *DestService) DestDatabaseExist(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*DestService) DestTableExist ¶
func (c *DestService) DestTableExist(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*DestService) ModelToService ¶
func (c *DestService) ModelToService(m *models.Destination) *DestService
func (*DestService) QueryDest ¶
func (c *DestService) QueryDest(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
func (*DestService) ServiceToModel ¶
func (c *DestService) ServiceToModel() *models.Destination
func (*DestService) UpdateDest ¶
func (c *DestService) UpdateDest(ctx *gin.Context) (common.ServiceCode, error)
type PolicyRevisionService ¶
type PolicyRevisionService struct { Model PolicyID uint `json:"policy_id"` // 策略ID ModifyField string `json:"modify_field"` // 修改字段 OldValue string `json:"old_value"` // 原始值 NewValue string `json:"new_value"` // 修改值 }
func (*PolicyRevisionService) CreatePolicyRevision ¶
func (c *PolicyRevisionService) CreatePolicyRevision(ctx *gin.Context, old, new *models.Policy) (common.ServiceCode, error)
func (*PolicyRevisionService) ModelToService ¶
func (c *PolicyRevisionService) ModelToService(m *models.PolicyRevision) *PolicyRevisionService
func (*PolicyRevisionService) QueryPolicyRevision ¶
func (c *PolicyRevisionService) QueryPolicyRevision(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
func (*PolicyRevisionService) ServiceToModel ¶
func (c *PolicyRevisionService) ServiceToModel() *models.PolicyRevision
type PolicyService ¶
type PolicyService struct { // 归档策略元数据信息 Model Name string `json:"name"` // 策略名称 Description string `json:"description"` // 说明 Bu string `json:"bu"` // 资产BU Enable bool `json:"enable"` // 是否生效 Period common.PeriodType `json:"period"` // 执行周期 执行一次:once, 每月一次:monthly, 每季度一次:quarterly, 每半年一次:six-months, 每年一次:yearly Day int `json:"day"` // 期望在每月的几号执行,对于执行周期小于一个月的任务不生效 ExecuteWindow []string `json:"execute_window"` // 执行时间窗口 如: [] 或者 ["03:00:00", "05:00:00"] Pause bool `json:"pause"` // 执行窗口外是否需要暂停执行 RebuildFlag bool `json:"rebuild_flag"` // 执行窗口外是否重建表(仅在治理方式是删除时有效)。true:在执行窗口外仍然走重建流程; false:执行窗口外跳过重建流程 CleaningSpeed common.CleaningSpeedType `json:"cleaning_speed"` // 清理速度 稳定优先:steady, 速度适中:balanced, 速度优先:swift // 源端信息 SrcID uint `json:"src_id"` // 源端ID SrcName string `json:"src_name"` // 源端名称 SrcClusterName string `json:"src_cluster_name"` // 集群名称 SrcClusterID string `json:"src_cluster_id"` // 集群ID SrcDatabaseName string `json:"src_database_name"` // 源库名 SrcTablesName string `json:"src_tables_name"` // 源表名 // 数据治理方式 Govern common.GovernType `json:"govern"` // 数据治理方式 清空数据:truncate, 不备份清理:delete, 备份后清理:backup-delete, 归档:archive, 重建表:recreate Condition string `json:"condition"` // 数据治理条件, where条件 ArchiveScope string `json:"archive_scope"` // 数据归档范围,归档那些列(仅归档涉及) RetainSrcData bool `json:"retain_src_data"` // 归档时否保留源表数据默认不保留(仅归档涉及) // 目标端信息 DestID uint `json:"dest_id"` // 目标端ID ForceArchive bool `json:"force_archive"` // 当目标库、表都存在时强制向目标端归档 // 结果通知 Relevant []string `json:"relevant"` // 关注人 NotifyPolicy common.NotifyPolicyType `json:"notify_policy"` // 通知策略 不通知:silence, 成功时通知:success, 失败时通知:failed, 成功或失败都通知:always }
func (*PolicyService) CheckParameters ¶
func (c *PolicyService) CheckParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*PolicyService) CheckUpdateParameters ¶
func (c *PolicyService) CheckUpdateParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*PolicyService) CreatePolicy ¶
func (c *PolicyService) CreatePolicy(ctx *gin.Context) (common.ServiceCode, error)
func (*PolicyService) DeletePolicy ¶
func (c *PolicyService) DeletePolicy(ctx *gin.Context) (common.ServiceCode, error)
func (*PolicyService) ModelToService ¶
func (c *PolicyService) ModelToService(m *models.Policy) *PolicyService
func (*PolicyService) QueryPolicy ¶
func (c *PolicyService) QueryPolicy(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
func (*PolicyService) ServiceToModel ¶
func (c *PolicyService) ServiceToModel() *models.Policy
func (*PolicyService) UpdatePolicy ¶
func (c *PolicyService) UpdatePolicy(ctx *gin.Context) (common.ServiceCode, error)
type PolicyStatistic ¶
type PolicyStatistic struct { Total int `json:"total"` Data []PolicyStatisticDetail `json:"data"` }
PolicyStatistic 策略统计信息
func (*PolicyStatistic) PolicyStatisticDetail ¶
func (c *PolicyStatistic) PolicyStatisticDetail(ctx *gin.Context, groupBy string, queryMap map[string]string) (any, common.ServiceCode, error)
type PolicyStatisticDetail ¶
type PolicyStatisticDetail struct { Bu string `json:"bu"` ClusterName string `json:"cluster_name"` Database string `json:"database"` Table string `json:"table"` Govern string `json:"govern"` Period string `json:"period"` Condition string `json:"condition"` Count int64 `json:"count"` // 策略个数 }
PolicyStatisticDetail 策略统计信息
type SourceService ¶
type SourceService struct { // 源端信息 Model Name string `json:"name"` // 源端名称 Description string `json:"description"` // 说明 Bu string `json:"bu"` // 资产BU ClusterName string `json:"cluster_name"` // 集群名称 ClusterID string `json:"cluster_id" ` // 集群ID DatabaseName string `json:"database_name"` // 源库名 TablesName string `json:"tables_name"` // 源表名 }
func (*SourceService) CheckParameters ¶
func (c *SourceService) CheckParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*SourceService) CreateSource ¶
func (c *SourceService) CreateSource(ctx *gin.Context) (common.ServiceCode, error)
func (*SourceService) DeleteSource ¶
func (c *SourceService) DeleteSource(ctx *gin.Context) (common.ServiceCode, error)
func (*SourceService) ModelToService ¶
func (c *SourceService) ModelToService(m *models.Source) *SourceService
func (*SourceService) QuerySource ¶
func (c *SourceService) QuerySource(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
func (*SourceService) ServiceToModel ¶
func (c *SourceService) ServiceToModel() *models.Source
func (*SourceService) UpdateSource ¶
func (c *SourceService) UpdateSource(ctx *gin.Context) (common.ServiceCode, error)
type StatisticDetail ¶
type Task ¶
type Task struct { ID uint `json:"id"` // ID Name string `json:"name"` TaskStartTime string `json:"task_start_time"` // 开始执行时间 TaskEndTime string `json:"task_end_time"` // 执行结束时间 TaskStatus common.TaskStatusType `json:"task_status"` // 任务状态 TaskResultQuantity int `json:"task_result_quantity"` // 治理数据量 TaskResultSize int `json:"task_result_size"` // 治理数据容量 }
type TaskChangeLogService ¶
type TaskChangeLogService struct { ID uint `json:"id"` TaskID uint `json:"task_id"` // 任务ID Time string `json:"time"` // 创建时间 UserName string `json:"user_name"` // 创建人 TaskStatus common.TaskStatusType `json:"task_status"` // 任务状态 Content string `json:"content"` // 变化内容记录 }
TaskChangeLogService 任务的执行过程记录
func (*TaskChangeLogService) ModelToService ¶
func (c *TaskChangeLogService) ModelToService(m *models.TaskChangeLog) *TaskChangeLogService
func (*TaskChangeLogService) QueryTaskChangeLog ¶
func (c *TaskChangeLogService) QueryTaskChangeLog(ctx *gin.Context) (any, common.ServiceCode, error)
func (*TaskChangeLogService) ServiceToModel ¶
func (c *TaskChangeLogService) ServiceToModel() *models.TaskChangeLog
type TaskPlanService ¶
type TaskPlanService struct { StartDate string `json:"start_date"` EndDate string `json:"end_date"` Count int `json:"count"` Tasks []*Task `json:"tasks"` }
TaskPlanService 任务统计信息
func (*TaskPlanService) TaskExecPlan ¶
func (c *TaskPlanService) TaskExecPlan(ctx *gin.Context) (any, common.ServiceCode, error)
type TaskRevisionService ¶
type TaskRevisionService struct { Model TaskID uint `json:"task_id"` // 任务ID ModifyField string `json:"modify_field"` // 修改字段 OldValue string `json:"old_value"` // 原始值 NewValue string `json:"new_value"` // 修改值 }
func (*TaskRevisionService) CreateTaskRevision ¶
func (c *TaskRevisionService) CreateTaskRevision(ctx *gin.Context, old, new *models.Task) (common.ServiceCode, error)
func (*TaskRevisionService) ModelToService ¶
func (c *TaskRevisionService) ModelToService(m *models.TaskRevision) *TaskRevisionService
func (*TaskRevisionService) QueryTaskRevision ¶
func (c *TaskRevisionService) QueryTaskRevision(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
func (*TaskRevisionService) ServiceToModel ¶
func (c *TaskRevisionService) ServiceToModel() *models.TaskRevision
type TaskService ¶
type TaskService struct { // 归档任务元数据信息 Model Name string `json:"name"` // 任务名称 Description string `json:"description"` // 说明 Enable bool `json:"enable"` // 是否生效 PolicyID uint `json:"policy_id"` // 策略ID ExecuteWindow []string `json:"execute_window"` // 执行窗口 ExecuteDate string `json:"execute_date"` // 预计执行日期 "2024-01-02" Pause bool `json:"pause"` // 执行窗口外是否需要暂停执行 RebuildFlag bool `json:"rebuild_flag"` // 执行窗口外是否重建表(仅在治理方式是删除时有效)。true:在执行窗口外仍然走重建流程; false:执行窗口外跳过重建流程 TaskStatus common.TaskStatusType `json:"task_status"` // 任务状态 TaskReason string `json:"task_reason"` // 任务失败原因 TaskDetail string `json:"task_detail"` // 任务失败详情 TaskResultQuantity int `json:"task_result_quantity"` // 治理数据量 TaskResultSize int `json:"task_result_size"` // 治理数据大小 TaskStartTime string `json:"task_start_time"` // 开始执行时间 TaskEndTime string `json:"task_end_time"` // 执行结束时间 TaskDuration int `json:"task_duration"` // 执行时长(秒) WorkFlow string `json:"workflow"` // 工作流 WorkFlowURL string `json:"workflow_url"` // 工作流地址 // 源端信息 SrcID uint `json:"src_id"` // 任务ID SrcName string `json:"src_name"` // 源端名称 SrcBu string `json:"src_bu"` // 资产BU SrcClusterName string `json:"src_cluster_name"` // 集群名称 SrcClusterID string `json:"src_cluster_id"` // 集群ID SrcAddr string `json:"src_addr"` // 源端地址 SrcDatabaseName string `json:"src_database_name"` // 源库名 SrcTablesName string `json:"src_tables_name"` // 源表名 SrcColumns string `json:"src_columns"` // 源列名 // 目标端信息 DestID uint `json:"dest_id"` // 目标端ID DestName string `json:"dest_name"` // 目标端名称 DestStorage common.StorageType `json:"dest_storage"` // 归档介质 DestConnectionID uint `json:"dest_connection_id"` // 归档库连接信息 DestDatabaseName string `json:"dest_database_name"` // 归档库名 DestTableName string `json:"dest_table_name"` // 归档表名 DestCompress bool `json:"dest_compress"` // 是否压缩存储 // 数据治理方式 Govern common.GovernType `json:"govern" ` // 数据治理方式 清空数据:truncate, 不备份清理:delete, 备份后清理:backup-delete, 归档:archive Condition string `json:"condition"` // 数据治理条件 RetainSrcData bool `json:"retain_src_data"` //归档时否保留源表数据 CleaningSpeed common.CleaningSpeedType `json:"cleaning_speed"` // 清理速度 稳定优先:steady, 速度适中:balanced, 速度优先:swift // 结果通知 Relevant []string `json:"relevant"` // 关注人 NotifyPolicy common.NotifyPolicyType `json:"notify_policy"` // 通知策略 不通知:silence, 成功时通知:success, 失败时通知:failed, 成功或失败都通知:always }
func UpdateTaskResult ¶
func UpdateTaskResult(ctx *gin.Context, c *types.TaskResultService) (*TaskService, common.ServiceCode, error)
func (*TaskService) CheckUpdateParameters ¶
func (c *TaskService) CheckUpdateParameters(ctx *gin.Context) (bool, common.ServiceCode, error)
func (*TaskService) DeleteTask ¶
func (c *TaskService) DeleteTask(ctx *gin.Context) (common.ServiceCode, error)
func (*TaskService) ModelToService ¶
func (c *TaskService) ModelToService(m *models.Task) *TaskService
func (*TaskService) QueryTask ¶
func (c *TaskService) QueryTask(ctx *gin.Context, queryMap map[string]string) (any, common.ServiceCode, error)
func (*TaskService) ServiceToModel ¶
func (c *TaskService) ServiceToModel() *models.Task
func (*TaskService) UpdateTask ¶
func (c *TaskService) UpdateTask(ctx *gin.Context) (common.ServiceCode, error)
type TaskStatisticDetail ¶
type TaskStatisticDetail struct { StartDate string `json:"start_date"` EndDate string `json:"end_date"` Total int `json:"total"` Data []StatisticDetail `json:"data"` }
TaskStatisticDetail 任务统计信息
func (*TaskStatisticDetail) TaskStatisticDetail ¶
func (c *TaskStatisticDetail) TaskStatisticDetail(ctx *gin.Context, groupBy string, queryMap map[string]string) (any, common.ServiceCode, error)
type TaskStatisticService ¶
type TaskStatisticService struct { StartDate string `json:"start_date"` EndDate string `json:"end_date"` Success int `json:"success"` // 执行成功个数 Fail int `json:"fail"` // 失败任务个数 Executing int `json:"executing"` // 执行中任务个数 Upcoming int `json:"upcoming"` // 待执行任务个数 }
TaskStatisticService 任务统计信息
func (*TaskStatisticService) TaskStatisticSummary ¶
func (c *TaskStatisticService) TaskStatisticSummary(ctx *gin.Context) (any, common.ServiceCode, error)
type UserService ¶
type UserService struct { Model Username string `json:"username"` // 用户名 Password string `json:"password"` // 密码 RealName string `json:"real_name"` // 姓名 Email string `json:"email"` // 邮箱 IsLdap uint `json:"is_ldap"` // 是否是LDAP用户 LastLogin string `json:"last_login"` // 上次登录时间 Token string `json:"token"` // token,登录成功后返回 }
func (*UserService) DeleteUser ¶
func (c *UserService) DeleteUser(ctx *gin.Context) (*UserService, common.ServiceCode, error)
DeleteUser 删除本地用户
func (*UserService) ModelToService ¶
func (c *UserService) ModelToService(m *models.User) *UserService
func (*UserService) ModifyUserInfo ¶
func (c *UserService) ModifyUserInfo(ctx *gin.Context) (*UserService, common.ServiceCode, error)
ModifyUserInfo 修改用户信息
func (*UserService) QueryUsers ¶
func (c *UserService) QueryUsers(ctx *gin.Context) (any, common.ServiceCode, error)
QueryUsers 查询用户
func (*UserService) RegisterUser ¶
func (c *UserService) RegisterUser(ctx *gin.Context) (*UserService, common.ServiceCode, error)
RegisterUser 注册本地用户
func (*UserService) ServiceToModel ¶
func (c *UserService) ServiceToModel() *models.User
func (*UserService) UserLogin ¶
func (c *UserService) UserLogin(ctx *gin.Context) (*UserService, common.ServiceCode, error)
UserLogin 用户登录
Click to show internal directories.
Click to hide internal directories.