Documentation ¶
Index ¶
- Constants
- Variables
- func AddTask(task *OwlTask) (int64, error)
- func BackupAndExec(db *sql.DB, item *OwlExecItem, taskType string) error
- func CheckTaskType(task *OwlTask) error
- func Exec(paramTask, dbTask *OwlTask) error
- func ExecTask(paramTask, dbTask *OwlTask) error
- func ExecTaskDirectly(paramTask, dbTask *OwlTask) error
- func GetTableInfo(req *SqlParam) (string, error)
- func GetTypeName(taskType string) string
- func IsDba(userName string) (isDba bool, err error)
- func Rollback(req *SqlParam) error
- func SetAuthTools(impl authTools)
- func SetBackupDao(impl BackupDao)
- func SetChecker(impl sqlChecker)
- func SetDbTools(impl dbTools)
- func SetSubTaskDao(impl SubTaskDao)
- func SetTaskDao(impl TaskDao)
- func StatusName(status Status) string
- func UpdateTask(task *OwlTask) error
- type Action
- type BackupDao
- type BackupDataResp
- type DBInfo
- type EditAuth
- type ItemStatus
- type OwlAccount
- type OwlBackup
- type OwlExecItem
- type OwlSubtask
- type OwlTask
- type ReadResult
- type SqlParam
- type Status
- type SubTaskDao
- type TaskDao
- type TaskType
Constants ¶
View Source
const ( // todo, del useless status; 从写只使用了很少的状态 //顺序递进 CheckFailed Status = "checkFailed" CheckPass = "checkPass" ReviewPass = "reviewPass" DBAPass = "dbaPass" ExecWait = "execWait" Executing = "executing" ExecFailed = "execFailed" ExecSuccess = "execSuccess" //终止状态 Reject Status = "reject" Cancel = "cancel" ExecCancel = "execCancel" //子项状态 SkipExec Status = "skipExec" )
View Source
const ( ItemFailed ItemStatus = "failed" ItemCheckFailed = "check_failed" ItemCheckPass = "check_pass" ItemSuccess = "success" ItemSkipped = "skipped" ItemNoBackup ItemStatus = "no_backup" ItemBackupSuccess = "backup_success" ItemBackupFailed = "backup_failed" ItemRollBackFailed = "roll_backup_failed" ItemRollBackSuccess = "roll_backup_success" )
View Source
const ( DML TaskType = "DML" DDLCreate = "CREATE" DDLUpdate = "UPDATE" )
View Source
const ( EditItem Action = "editItem" DelItem = "delItem" DoCancel = "cancel" SkipAt = "skipAt" BeginAt = "beginAt" DoExec = "exec" DoReject = "reject" Resubmit = "resubmit" )
View Source
const (
NUL = ""
)
Variables ¶
View Source
var AuthTool authTools
Functions ¶
func BackupAndExec ¶
func BackupAndExec(db *sql.DB, item *OwlExecItem, taskType string) error
backup, exec, update status
func CheckTaskType ¶
func ExecTaskDirectly ¶
exec and update status exec from head, skip at some one, or begin at some one
func GetTableInfo ¶
func GetTypeName ¶
func SetAuthTools ¶
func SetAuthTools(impl authTools)
func SetBackupDao ¶
func SetBackupDao(impl BackupDao)
func SetChecker ¶
func SetChecker(impl sqlChecker)
func SetDbTools ¶
func SetDbTools(impl dbTools)
func SetSubTaskDao ¶
func SetSubTaskDao(impl SubTaskDao)
func SetTaskDao ¶
func SetTaskDao(impl TaskDao)
func StatusName ¶
func UpdateTask ¶
Types ¶
type BackupDataResp ¶
type BackupDataResp struct { DataItems [][]string `json:"data_items"` Index []int `json:"index"` Columns []string `json:"columns"` }
func ListRollbackData ¶
func ListRollbackData(req *SqlParam) (*BackupDataResp, error)
ListRollbackData ...
type EditAuth ¶
type EditAuth struct { SubmitReviewEnable bool `json:"submit_review_enable"` SysReviewEnable bool `json:"sys_review_enable"` WithdrawEnable bool `json:"withdraw_enable"` TurnDownEnable bool `json:"turn_down_enable"` SubmitExecEnable bool `json:"submit_exec_enable"` ExecEnable bool `json:"exec_enable"` TurnDownExecEnable bool `json:"turn_down_exec_enable"` ReviewEnable bool `json:"review_enable"` ReviewPassEnable bool `json:"review_pass_enable"` CreatorSubmitReviewEnable bool `json:"creator_submit_review_enable"` CreatorTurnDownEnable bool `json:"creator_turn_down_enable"` }
func GetTaskOperateAuth ¶
GetTaskOpAbility根据task状态,获取角色的可操作类型
type ItemStatus ¶
type ItemStatus = string
func ExecStatus ¶
func ExecStatus() []ItemStatus
func HistoryStatus ¶
func HistoryStatus() []ItemStatus
func SubmitStatus ¶
func SubmitStatus() []ItemStatus
type OwlAccount ¶
type OwlBackup ¶
type OwlBackup struct { ID int64 `json:"id" gorm:"column:id"` Data string `json:"data" gorm:"column:data"` Ct int64 `json:"ct" gorm:"column:ct"` RollbackTime int64 `json:"rollback_time" gorm:"column:rollback_time"` RollbackUser string `json:"rollback_user" gorm:"column:rollback_user"` IsRolledBack int `json:"is_rolled_back" gorm:"column:is_rolled_back"` }
type OwlExecItem ¶
type OwlExecItem struct { ID int64 `json:"id" gorm:"column:id"` TaskID int64 `json:"task_id" gorm:"column:task_id"` SubtaskID int64 `json:"subtask_id" gorm:"column:subtask_id"` SQLContent string `json:"sql_content" gorm:"column:sql_content"` Remark string `json:"remark" gorm:"column:remark"` AffectRows int `json:"affect_rows" gorm:"column:affect_rows"` RuleComments string `json:"rule_comments" gorm:"column:rule_comments"` Status string `json:"status" gorm:"column:status"` ExecInfo string `json:"exec_info" gorm:"column:exec_info"` BackupInfo string `json:"backup_info" gorm:"column:backup_info"` BackupStatus string `json:"backup_status" gorm:"column:backup_status"` BackupID int64 `json:"backup_id" gorm:"column:backup_id"` Ut int64 `json:"ut" gorm:"column:ut"` Et int64 `json:"et" gorm:"column:et"` DBName string `json:"db_name" gorm:"-"` ClusterName string `json:"cluster_name" gorm:"-"` TaskType string `json:"task_type" gorm:"-"` }
type OwlSubtask ¶
type OwlSubtask struct { ID int64 `json:"id" gorm:"column:id"` TaskID int64 `json:"task_id" gorm:"column:task_id"` TaskType string `json:"task_type" gorm:"column:task_type"` DbName string `json:"db_name" gorm:"column:db_name"` ClusterName string `json:"cluster_name" gorm:"column:cluster_name"` ExecItems []OwlExecItem `json:"exec_items" gorm:"-"` }
type OwlTask ¶
type OwlTask struct { ID int64 `json:"id" gorm:"column:id"` Name string `json:"name" gorm:"column:name"` Status string `json:"status" gorm:"column:status"` Creator string `json:"creator" gorm:"column:creator"` Reviewer string `json:"reviewer" gorm:"column:reviewer"` Executor string `json:"executor" gorm:"column:executor"` ExecInfo string `json:"exec_info" gorm:"column:exec_info"` RejectContent string `json:"reject_content" gorm:"column:reject_content"` Ct int64 `json:"ct" gorm:"column:ct"` Ut int64 `json:"ut" gorm:"column:ut"` Et int64 `json:"et" gorm:"column:et"` Ft int64 `json:"ft" gorm:"column:ft"` SubTasks []OwlSubtask `json:"sub_tasks" gorm:"-"` ExecItems []OwlExecItem `json:"exec_items" gorm:"-"` ExecItem *OwlExecItem `json:"exec_item" gorm:"-"` EditAuth *EditAuth `json:"edit_auth" gorm:"-"` StatusName string `json:"status_name" gorm:"-"` Action Action `json:"action" gorm:"-"` }
func GetExecWaitTask ¶
func ListTask ¶
func ListTask(pageInfo request.SortPageInfo, status []ItemStatus) ([]OwlTask, int64, error)
type ReadResult ¶
type ReadResult struct { DataItems interface{} `json:"data_items"` Columns []string `json:"columns"` }
type SubTaskDao ¶
type SubTaskDao interface { UpdateItem(item *OwlExecItem) error DelItem(item *OwlExecItem) error UpdateItemByBackupId(item *OwlExecItem) error }
Click to show internal directories.
Click to hide internal directories.