Documentation ¶
Index ¶
- Constants
- Variables
- func AddWhiteList(ctx context.Context, db *gorm.DB, WhiteList *WhiteList) (int64, error)
- func DelWhiteList(ctx context.Context, db *gorm.DB, id int64) error
- func ExecQuery(ctx context.Context, req *Params) interface{}
- func ExecReadTask(ctx context.Context, params *Params) (interface{}, error)
- func GetDB() *gorm.DB
- func NewRedisCli(clusterName string, database int) (r *redis.Client, err error)
- func SetRedisTaskDao(impl RedisTaskDao)
- func SetWhiteListDao(impl WhiteListDao)
- type Check
- type Params
- type PermitCmd
- type RedisTask
- func (r *RedisTask) AddTask(ctx context.Context, cluster string, db int, parentTaskID int64) (int64, bool, error)
- func (r *RedisTask) ExecTask(ctx context.Context, startSubTaskId, taskId int64, cluster, db string) error
- func (r *RedisTask) GetTask(id int64) (interface{}, error)
- func (r *RedisTask) ListPageTask(pageInfo request.SortPageInfo, isDBA bool, status []string) (interface{}, int64, error)
- func (r *RedisTask) ListTask(parentTaskID int64) (interface{}, error)
- func (r *RedisTask) UpdateTask(action string) error
- type RedisTaskDao
- type WhiteList
- type WhiteListDao
Constants ¶
View Source
const ( CheckTypeExist = "exist" CheckTypeNum = "limit_num" CheckTypeOnlyString = "only_string" )
View Source
const CheckPass = "pass"
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func AddWhiteList ¶
func NewRedisCli ¶
func SetRedisTaskDao ¶
func SetRedisTaskDao(impl RedisTaskDao)
func SetWhiteListDao ¶
func SetWhiteListDao(impl WhiteListDao)
Types ¶
type PermitCmd ¶
type PermitCmd struct { Cmd string `json:"cmd"` // key; 去匹配用户输入命令的第一个字段 CheckType string `json:"check_type"` // val-1; 0 just match, 1 check nums , 2 only string LenLimit int64 `json:"len_limit"` // val-2; }
config eg: key: cmd, val : CheckType,LenLimit
type RedisTask ¶
type RedisTask struct { ID int64 `json:"id" gorm:"column:id"` TaskID int64 `json:"task_id" gorm:"column:task_id"` Cmd string `json:"cmd" gorm:"column:cmd"` ExecInfo string `json:"exec_info" gorm:"column:exec_info"` CheckInfo string `json:"check_info" gorm:"column:check_info"` }
func (*RedisTask) ListPageTask ¶
func (*RedisTask) UpdateTask ¶
type RedisTaskDao ¶
type RedisTaskDao interface { AddTask(db *gorm.DB, task *RedisTask) (int64, error) UpdateTask(db *gorm.DB, task *RedisTask) error ListRedisTaskByTaskID(db *gorm.DB, id int64) ([]RedisTask, error) ListTask(db *gorm.DB, pageInfo request.SortPageInfo, isDBA bool, status []string) ([]RedisTask, int64, error) GetTask(db *gorm.DB, id int64) (*RedisTask, error) }
type WhiteList ¶
type WhiteList struct { ID int64 `json:"id" gorm:"column:id"` Cmd string `json:"cmd" gorm:"column:cmd"` CheckType string `json:"check_type" gorm:"column:check_type"` //exist;limit_num,xx;only_string CmdType string `json:"cmd_type" gorm:"column:cmd_type"` Creator string `json:"creator" gorm:"column:creator"` CreateTime int64 `json:"create_time" gorm:"column:create_time"` }
func ListReadWhiteList ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.