ability_task_model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package ability_task_model stores durable asynchronous task records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncTask

type AsyncTask struct {
	gorm.Model
	TaskID          string     `gorm:"type:char(36);not null;uniqueIndex" json:"task_id"`
	UserID          *string    `gorm:"type:char(36);index;comment:受理时刻的属主身份快照,无属主任务为 NULL" json:"user_id"`
	Method          string     `gorm:"size:191;not null;index" json:"method"`
	RunStatus       string     `` /* 154-byte string literal not displayed */
	ProcessStatus   string     `` /* 192-byte string literal not displayed */
	Progress        float64    `gorm:"not null;default:0;comment:量化进度 0-100" json:"progress"`
	ProgressMessage string     `gorm:"size:512" json:"progress_message"`
	ErrorCode       int        `gorm:"not null;default:0" json:"error_code"`
	ErrorMessage    string     `gorm:"size:512" json:"error_message"`
	InputPayload    string     `gorm:"type:mediumtext;comment:受理时的 arguments JSON,Worker 重放输入" json:"-"`
	ResultPayload   string     `gorm:"type:mediumtext;comment:success 时的 Execute 返回值 JSON" json:"-"`
	StartedAt       *time.Time `gorm:"index" json:"started_at"`
	CompletedAt     *time.Time `gorm:"index" json:"completed_at"`
}

AsyncTask 状态三字段核心:RunStatus(程序级)+ ProcessStatus(业务级)+ Progress(量化进度)。 两层状态值域零交集:RunStatus 只表达调度生命周期,ProcessStatus 只表达业务处理结局; RunStatus=done 是唯一终态,且 done ⟺ ProcessStatus 非空。 枚举值与 ability_task 包内 RunStatus* / ProcessStatus* 常量及列 comment 三处同步维护。

Jump to

Keyboard shortcuts

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