models

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unload = "unload"
	Loaded = "loaded"
	Finish = "finish"
)

Variables

View Source
var ErrRowsAffected = errors.New("rows affected is zero")

Functions

This section is empty.

Types

type Task

type Task struct {
	ID             int       `gorm:"primaryKey" json:"id"`
	CreatedAt      time.Time `json:"created_at"`                    // 创建时间
	UpdatedAt      time.Time `json:"updated_at"`                    // 更新时间
	UniqueKey      string    `gorm:"uniqueIndex" json:"unique_key"` // 唯一键
	Url            string    `json:"url"`                           // 请求链接
	Params         string    `json:"params"`                        // 请求参数
	ParserFunction string    `json:"parser_function"`               // 解析方法
	FailedReason   string    `json:"failed_reason"`                 // 失败原因
	Status         string    `json:"status"`                        // 任务状态
	Title          string    `json:"title"`                         // 任务标题
	Content        string    `json:"content"`                       // 数据主体
	Remark         string    `json:"remark"`                        // 备注
}

func (*Task) All

func (t *Task) All(tx *gorm.DB) (task []Task)

func (*Task) CountUnload

func (t *Task) CountUnload(tx *gorm.DB) (count int64)

func (*Task) GetUnFinished

func (t *Task) GetUnFinished(tx *gorm.DB) (lines []Task, err error)

func (*Task) Load

func (t *Task) Load(tx *gorm.DB) error

func (*Task) Loaded2Unload

func (t *Task) Loaded2Unload(tx *gorm.DB) error

func (*Task) SetLineFinished

func (t *Task) SetLineFinished(tx *gorm.DB, updates map[string]interface{}) error

func (Task) TableName

func (t Task) TableName() string

func (*Task) Write

func (t *Task) Write(tx *gorm.DB) error

Jump to

Keyboard shortcuts

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