model

package
v0.0.0-...-281483f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmailNotify int = 1
	ForceKill   int = 2
	HealthCheck int = 3
	BothRun     int = 4
)

Variables

View Source
var DB *gorm.DB

Functions

func Automigrate

func Automigrate()

func Dbinit

func Dbinit() (*gorm.DB, error)

Types

type RedisDB

type RedisDB struct {
	Pool *redis.Pool
}
var Redis *RedisDB

func (*RedisDB) Bool

func (db *RedisDB) Bool(command string, args ...interface{}) (bool, error)

func (*RedisDB) Do

func (db *RedisDB) Do(command string, args ...interface{}) (interface{}, error)

func (*RedisDB) InitPool

func (db *RedisDB) InitPool()

func (*RedisDB) Int

func (db *RedisDB) Int(command string, args ...interface{}) (int, error)

func (*RedisDB) Ints

func (db *RedisDB) Ints(command string, args ...interface{}) ([]int, error)

func (*RedisDB) String

func (db *RedisDB) String(command string, args ...interface{}) (string, error)

func (*RedisDB) StringMap

func (db *RedisDB) StringMap(command string, args ...interface{}) (map[string]string, error)

func (*RedisDB) Strings

func (db *RedisDB) Strings(command string, args ...interface{}) ([]string, error)

type TaskResult

type TaskResult struct {
	Result  string
	Err     string
	Host    string
	Status  int64
	Endtime string
}

type VCron

type VCron struct {
	Id          uint      `gorm:"primary_key;AUTO_INCREMENT" json:"id"`
	Jobid       int64     `gorm:"type:int(50);comment:'作业ID';not null;index:IX_jobid" json:"jobid"`
	JobName     string    `gorm:"type:varchar(550);comment:'作业名字';not null" json:"job_name"`
	Cmd         string    `gorm:"type:varchar(200);comment:'执行命令';not null" json:"cmd"`
	Rule        string    `gorm:"type:varchar(100);comment:'cron规则';" json:"rule"`
	Runyear     string    `gorm:"type:int(2);comment:'执行年份 : 1每年,2今年';" json:"runyear"`
	Querytype   string    `gorm:"type:varchar(50);comment:'命令类型:wget,curl,phpget,other';not null" json:"querytype"`
	State       string    `gorm:"type:int(50);comment:'作业状态';not null" json:"state"`
	Author      string    `gorm:"type:varchar(50);comment:'作业属主';" json:"author"`
	AdminMobile string    `gorm:"type:varchar(10);comment:'属主电话';" json:"admin_mobile"`
	AdminEmail  string    `gorm:"type:varchar(100);comment:'属主邮箱';" json:"admin_email"`
	Remark      string    `gorm:"type:varchar(500);comment:'备注';" json:"remark"`
	Createtime  time.Time `gorm:"type:datetime;comment:'创建时间';" json:"create_time"`
	Runat       string    `gorm:"type:varchar(50);comment:'执行机器'" json:"runat"`
	Overflow    int       `` /* 173-byte string literal not displayed */
	Taskid      int64     `gorm:"-"`
	TaskStatus  int64     `gorm:"-"`
}

作业表

func (*VCron) GetAllJobList

func (task *VCron) GetAllJobList() ([]VCron, error)

获取所有激活任务

func (*VCron) GetJobInfo

func (task *VCron) GetJobInfo(Jobid int64) ([]VCron, error)

func (VCron) TableName

func (VCron) TableName() string

type VLog

type VLog struct {
	Id         uint      `gorm:"primary_key;AUTO_INCREMENT" json:"id"`
	Jobid      int64     `gorm:"type:int(50);comment:'作业ID';not null;index:IX_jobid" json:"jobid"`
	JobName    string    `gorm:"type:varchar(550);comment:'作业名字';not null" json:"job_name"`
	Status     int64     `` /* 168-byte string literal not displayed */
	Starttime  time.Time `gorm:"type:datetime;comment:'开始时间';" json:"starttime"`
	Endtime    time.Time `gorm:"type:datetime;default null;comment:'结束时间';" json:"endtime"`
	Cmd        string    `gorm:"type:varchar(200);comment:'执行命令';not null" json:"cmd"`
	Error      string    `gorm:"type:varchar(500);comment:'错误信息'" json:"error"`
	Runat      string    `gorm:"type:varchar(50);comment:'执行机器'" json:"runat"`
	Jobdata    string    `gorm:"type:varchar(1000);comment:'Job data'" json:"jobdata"`
	Createtime time.Time `gorm:"type:datetime;comment:'创建时间';" json:"createtime"`
	Updatetime time.Time `gorm:"type:datetime;comment:'修改时间';" json:"updatetime"`
}

CRON日志表

func (*VLog) CreateTaskLog

func (task *VLog) CreateTaskLog(Job VCron) (int64, error)

创建任务日志

func (VLog) TableName

func (VLog) TableName() string

func (*VLog) UpdateTaskLog

func (task *VLog) UpdateTaskLog(taskLogId int64, taskResult TaskResult) (int64, error)

更新任务日志

type VUser

type VUser struct {
	Id         uint      `gorm:"primary_key;AUTO_INCREMENT" json:"id"`
	Userid     int       `gorm:"type:int(50);comment:'用户ID';not null;index:IX_user_id" json:"user_id"`
	Username   string    `gorm:"type:varchar(550);comment:'用户名字';not null" json:"user_name"`
	Email      string    `gorm:"type:varchar(200);comment:'邮箱';not null" json:"email"`
	Password   string    `gorm:"type:varchar(100);comment:'密码';" json:"password"`
	Isactive   string    `gorm:"type:varchar(50);comment:'是否激活 0:未激活,1:激活';not null" json:"is_active"`
	Createtime time.Time `gorm:"type:datetime;comment:'创建时间';" json:"create_time"`
	LastLogin  time.Time `gorm:"type:datetime;comment:'上次登录时间';" json:"last_login"`
}

用户表

func (VUser) TableName

func (VUser) TableName() string

type Vuserlog

type Vuserlog struct {
	Id            uint      `gorm:"primary_key;AUTO_INCREMENT" json:"id"`
	Jobid         int       `gorm:"type:int(50);comment:'作业ID';not null;index:IX_jobid" json:"jobid"`
	JobName       string    `gorm:"type:varchar(550);comment:'作业名字';not null" json:"job_name"`
	Userid        int       `gorm:"type:int(50);comment:'用户ID';not null;index:IX_user_id" json:"user_id"`
	Modifycontent string    `gorm:"type:varchar(1000);comment:'Job data'" json:"modify_content"`
	Mtype         int       `gorm:"type:int(50);comment:'修改类型(creat,modify)';not null;" json:"mtype"`
	Createtime    time.Time `gorm:"type:datetime;comment:'创建时间';" json:"createtime"`
}

cron用户日志表

func (Vuserlog) TableName

func (Vuserlog) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL