model

package
v0.2.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConditionTrue    string = "True"
	ConditionFalse   string = "False"
	ConditionUnknown string = "Unknown"
)
View Source
const TableNameCronJobM = "nw_cronjob"
View Source
const TableNameJobM = "nw_job"

Variables

View Source
var (
	ErrCronJobStatusInvalidType = errors.New("invalid type for CronJobStatus")
	ErrJobMInvalidType          = errors.New("invalid type for JobM")
	ErrJobParamsInvalidType     = errors.New("invalid type for JobParams")
	ErrJobResultsInvalidType    = errors.New("invalid type for JobResults")
	ErrJobConditionsInvalidType = errors.New("invalid type for JobConditions")
)

Functions

This section is empty.

Types

type CronJobM

type CronJobM struct {
	ID        int64  `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"`          // 主键 ID
	CronJobID string `gorm:"column:cronjob_id;type:varchar(100);not null;comment:CronJob ID" json:"cronjob_id"`                 // CronJob ID
	UserID    string `gorm:"column:user_id;type:varchar(100);not null;index:idx_user_id,priority:1;comment:创建人" json:"user_id"` // 创建人
	Scope     string ``                                                                                                         // CronJob 作用域
	/* 128-byte string literal not displayed */
	Name              string         `gorm:"column:name;type:varchar(255);not null;comment:CronJob 名称" json:"name"`               // CronJob 名称
	Description       string         `gorm:"column:description;type:varchar(256);not null;comment:CronJob 描述" json:"description"` // CronJob 描述
	Schedule          string         `gorm:"column:schedule;type:varchar(100);not null;comment:Quartz 格式的调度时间描述" json:"schedule"` // Quartz 格式的调度时间描述
	Status            *CronJobStatus `gorm:"column:status;type:longtext;comment:CronJob 任务状态" json:"status"`                      // CronJob 任务状态
	ConcurrencyPolicy int32          ``                                                                                           // 作业处理方式(1 串行,2 并行,3 替换)
	/* 156-byte string literal not displayed */
	Suspend             int32 `gorm:"column:suspend;type:tinyint(4);not null;comment:是否挂起(1 挂起,0 不挂起)" json:"suspend"` // 是否挂起(1 挂起,0 不挂起)
	JobTemplate         *JobM `gorm:"column:job_template;type:longtext;comment:Job 模版" json:"job_template"`            // Job 模版
	SuccessHistoryLimit int32 ``                                                                                       // 要保留的成功完成作业的数量。值必须是非负整数
	/* 175-byte string literal not displayed */
	FailedHistoryLimit int32 `` // 要保留的失败完成作业的数量。值必须是非负整数。
	/* 175-byte string literal not displayed */
	CreatedAt time.Time `gorm:"column:created_at;type:timestamp;not null;default:current_timestamp();comment:创建时间" json:"created_at"` // 创建时间
	UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;not null;default:current_timestamp();comment:更新时间" json:"updated_at"` // 更新时间
}

CronJobM mapped from table <nw_cronjob>

func (*CronJobM) AfterCreate

func (m *CronJobM) AfterCreate(tx *gorm.DB) (err error)

AfterCreate runs after creating a CronJobM database record and updates the JobID field.

func (*CronJobM) TableName

func (*CronJobM) TableName() string

TableName CronJobM's table name

type CronJobStatus

type CronJobStatus nwv1.CronJobStatus

func (*CronJobStatus) Scan

func (status *CronJobStatus) Scan(value interface{}) error

Scan implements the sql Scanner interface

func (*CronJobStatus) Value

func (status *CronJobStatus) Value() (driver.Value, error)

Value implements the sql Valuer interface

type JobConditions

type JobConditions []*nwv1.JobCondition

func (*JobConditions) Scan

func (conds *JobConditions) Scan(value interface{}) error

Scan implements the sql Scanner interface

func (*JobConditions) Value

func (conds *JobConditions) Value() (driver.Value, error)

Value implements the sql Valuer interface

type JobM

type JobM struct {
	ID          int64          `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"`                        // 主键 ID
	JobID       string         `gorm:"column:job_id;type:varchar(100);not null;comment:Job ID" json:"job_id"`                                           // Job ID
	UserID      string         `gorm:"column:user_id;type:varchar(100);not null;index:idx_user_id,priority:1;comment:创建人" json:"user_id"`               // 创建人
	Scope       string         `gorm:"column:scope;type:varchar(256);not null;index:idx_scope,priority:1;default:default;comment:Job 作用域" json:"scope"` // Job 作用域
	Name        string         `gorm:"column:name;type:varchar(255);not null;comment:Job 名称" json:"name"`                                               // Job 名称
	Description string         `gorm:"column:description;type:varchar(256);not null;comment:Job 描述" json:"description"`                                 // Job 描述
	CronJobID   *string        `gorm:"column:cronjob_id;type:varchar(100);index:idx_task_id,priority:1;comment:CronJob ID,可选" json:"cronjob_id"`        // CronJob ID,可选
	Watcher     string         `gorm:"column:watcher;type:varchar(255);not null;comment:eam-nightwatch watcher 名字" json:"watcher"`                      // eam-nightwatch watcher 名字
	Suspend     int32          `gorm:"column:suspend;type:tinyint(4);not null;comment:是否挂起(1 挂起,0 不挂起)" json:"suspend"`                                 // 是否挂起(1 挂起,0 不挂起)
	Params      *JobParams     `gorm:"column:params;type:longtext;comment:Job 参数" json:"params"`                                                        // Job 参数
	Results     *JobResults    `gorm:"column:results;type:longtext;comment:Job 执行结果" json:"results"`                                                    // Job 执行结果
	Status      string         `gorm:"column:status;type:varchar(32);not null;default:Pending;comment:Job 状态" json:"status"`                            // Job 状态
	Conditions  *JobConditions `gorm:"column:conditions;type:longtext;comment:Job 运行状态" json:"conditions"`                                              // Job 运行状态
	StartedAt   time.Time      `gorm:"column:started_at;type:datetime;not null;comment:Job 开始时间" json:"started_at"`                                     // Job 开始时间
	EndedAt     time.Time      `gorm:"column:ended_at;type:datetime;not null;comment:Job 结束时间" json:"ended_at"`                                         // Job 结束时间
	CreatedAt   time.Time      `gorm:"column:created_at;type:timestamp;not null;default:current_timestamp();comment:创建时间" json:"created_at"`            // 创建时间
	UpdatedAt   time.Time      `gorm:"column:updated_at;type:timestamp;not null;default:current_timestamp();comment:更新时间" json:"updated_at"`            // 更新时间
}

JobM mapped from table <nw_job>

func (*JobM) AfterCreate

func (m *JobM) AfterCreate(tx *gorm.DB) (err error)

AfterCreate runs after creating a JobM database record and updates the JobID field.

func (*JobM) Scan

func (job *JobM) Scan(value interface{}) error

Scan implements the sql Scanner interface

func (*JobM) TableName

func (*JobM) TableName() string

TableName JobM's table name

func (*JobM) Value

func (job *JobM) Value() (driver.Value, error)

Value implements the sql Valuer interface

type JobParams

type JobParams nwv1.JobParams

func (*JobParams) Scan

func (params *JobParams) Scan(value interface{}) error

Scan implements the sql Scanner interface

func (*JobParams) Value

func (params *JobParams) Value() (driver.Value, error)

Value implements the sql Valuer interface

type JobResults

type JobResults nwv1.JobResults

func (*JobResults) Scan

func (result *JobResults) Scan(value interface{}) error

Scan implements the sql Scanner interface

func (*JobResults) Value

func (result *JobResults) Value() (driver.Value, error)

Value implements the sql Valuer interface

Jump to

Keyboard shortcuts

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