models

package
v0.0.0-...-2fa33bc Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StateMap = map[State]string{
	StateStopped: "stopped",
	StateRunning: "running",
	StateFailed:  "failed",
	StateUnknown: "unknown",
	StatePending: "pending",
	StatePaused:  "paused",
	StateSkipped: "skipped",
}

Functions

func Paginate

func Paginate(db *gorm.DB, page, pageSize int64) *gorm.DB

Types

type SBase

type SBase struct {
	ID        uuid.UUID `json:"id" gorm:"primarykey;comment:ID"`
	CreatedAt time.Time `json:"created_at" gorm:"comment:创建时间"`
	UpdatedAt time.Time `json:"updated_at" gorm:"comment:更新时间"`
}

func (*SBase) BeforeCreate

func (b *SBase) BeforeCreate(tx *gorm.DB) (err error)

type SEnv

type SEnv struct {
	Name   string `json:"name,omitempty" gorm:"size:256;index:,unique,composite:owner_name,priority:2;not null;comment:名称"`
	Value  string `json:"value,omitempty" gorm:"size:256;comment:值"`
	Secret bool   `json:"secret,omitzero" gorm:"not null;default:false;comment:敏感信息"`
}

type SEnvs

type SEnvs []*SEnv

type SReplay

type SReplay struct {
	SBase
	Date     string `json:"date" gorm:"size:10;not null;index:idx_replay_order,priority:1;comment:录像日期"`
	ReplayID string `json:"replay_id" gorm:"size:36;not null;uniqueIndex;index:idx_replay_order,priority:2;comment:录像标识"`
	FilePath string `json:"file_path" gorm:"size:1024;not null;comment:录像文件相对路径"`
	Size     int64  `json:"size" gorm:"not null;comment:压缩文件大小"`
}

SReplay records the database identity of a finalized terminal recording and the file containing its cast data. Keeping this mapping in the database allows replay listings to be paginated without scanning the replay directory on every request.

func (*SReplay) TableName

func (r *SReplay) TableName() string

type SStep

type SStep struct {
	SBase
	TaskID      uuid.UUID                                `json:"task_id" gorm:"not null;uniqueIndex:idx_task_id_step_name"`
	Task        *STask                                   `json:"-" gorm:"foreignKey:TaskID;references:ID;constraint:OnDelete:CASCADE"`
	Name        string                                   `json:"name,omitempty" gorm:"size:256;uniqueIndex:idx_task_id_step_name;not null;comment:名称"`
	Desc        string                                   `json:"desc,omitempty" gorm:"comment:描述"`
	Kind        string                                   `json:"kind,omitempty" gorm:"size:256;index;not null;comment:类型"`
	Content     string                                   `json:"content,omitempty" gorm:"comment:内容"`
	Options     datatypes.JSON                           `json:"options" gorm:"column:options;comment:执行器私有参数"`
	Routing     datatypes.JSONType[*iproto.SStepRouting] `json:"routing" gorm:"column:routing;comment:DAG依赖边、汇合策略与成功标签"`
	RetryPolicy datatypes.JSONType[*iproto.SRetryPolicy] `json:"retry_policy" gorm:"comment:重试策略"`
	Timeout     time.Duration                            `json:"timeout,omitempty" gorm:"not null;default:86400000000000;comment:超时时间"`
	SStepUpdate
}

func (*SStep) TableName

func (s *SStep) TableName() string

type SStepEnv

type SStepEnv struct {
	SBase
	StepID uuid.UUID `gorm:"not null;index:,unique,composite:owner_name,priority:1"`
	Step   *SStep    `gorm:"foreignKey:StepID;references:ID;constraint:OnDelete:CASCADE"`
	SEnv
}

func (*SStepEnv) TableName

func (*SStepEnv) TableName() string

type SStepLog

type SStepLog struct {
	SBase
	StepID    uuid.UUID `json:"step_id" gorm:"not null;uniqueIndex:idx_step_log_line"`
	Step      *SStep    `json:"-" gorm:"foreignKey:StepID;references:ID;constraint:OnDelete:CASCADE"`
	Timestamp int64     `json:"timestamp,omitempty" gorm:"not null;comment:时间戳"`
	Line      *int64    `json:"line,omitempty" gorm:"not null;uniqueIndex:idx_step_log_line;comment:行号"`
	Content   string    `json:"content,omitempty" gorm:"comment:内容"`
}

func (*SStepLog) TableName

func (l *SStepLog) TableName() string

type SStepLogs

type SStepLogs []*SStepLog

func (SStepLogs) Len

func (l SStepLogs) Len() int

func (SStepLogs) Less

func (l SStepLogs) Less(i, j int) bool

func (SStepLogs) Swap

func (l SStepLogs) Swap(i, j int)

type SStepUpdate

type SStepUpdate struct {
	Message  string        `json:"message,omitempty" gorm:"comment:消息"`
	State    *State        `json:"state,omitempty" gorm:"index;not null;default:0;comment:状态"`
	OldState *State        `json:"old_state,omitempty" gorm:"index;not null;default:0;comment:旧状态"`
	Code     *api.ExecCode `json:"code,omitempty" gorm:"index;not null;default:0;comment:退出码"`
	STime    *time.Time    `json:"s_time,omitempty" gorm:"comment:开始时间"`
	ETime    *time.Time    `json:"e_time,omitempty" gorm:"comment:结束时间"`
}

func (*SStepUpdate) ETimeStr

func (s *SStepUpdate) ETimeStr() string

func (*SStepUpdate) STimeStr

func (s *SStepUpdate) STimeStr() string

type SSteps

type SSteps []*SStep

func (SSteps) Len

func (s SSteps) Len() int

func (SSteps) Less

func (s SSteps) Less(i, j int) bool

func (SSteps) Swap

func (s SSteps) Swap(i, j int)

type STask

type STask struct {
	SBase
	Name    string        `json:"name,omitempty" gorm:"size:256;uniqueIndex;not null;comment:名称"`
	Workdir string        `json:"workdir,omitempty" gorm:"size:256;not null;comment:工作路径(相对路径)"`
	Timeout time.Duration `json:"timeout,omitempty" gorm:"not null;default:86400000000000;comment:超时时间"`
	Cleanup bool          `json:"cleanup,omitempty" gorm:"not null;default:false;comment:任务结束后是否清理工作目录,默认保留"`
	STaskUpdate
}

func (*STask) TableName

func (t *STask) TableName() string

type STaskEnv

type STaskEnv struct {
	SBase
	TaskID uuid.UUID `gorm:"not null;index:,unique,composite:owner_name,priority:1"`
	Task   *STask    `gorm:"foreignKey:TaskID;references:ID;constraint:OnDelete:CASCADE"`
	SEnv
}

func (*STaskEnv) TableName

func (*STaskEnv) TableName() string

type STaskUpdate

type STaskUpdate struct {
	Message  string     `json:"message,omitempty" gorm:"comment:消息"`
	State    *State     `json:"state,omitempty" gorm:"index;not null;default:0;comment:状态"`
	OldState *State     `json:"old_state,omitempty" gorm:"index;not null;default:0;comment:旧状态"`
	STime    *time.Time `json:"s_time,omitempty" gorm:"comment:开始时间"`
	ETime    *time.Time `json:"e_time,omitempty" gorm:"comment:结束时间"`
}

func (*STaskUpdate) ETimeStr

func (t *STaskUpdate) ETimeStr() string

func (*STaskUpdate) STimeStr

func (t *STaskUpdate) STimeStr() string

type STasks

type STasks []*STask

func (STasks) Len

func (t STasks) Len() int

func (STasks) Less

func (t STasks) Less(i, j int) bool

func (STasks) Swap

func (t STasks) Swap(i, j int)

type State

type State int
const (
	StateStopped State = iota // 成功
	StateRunning              // 运行
	StateFailed               // 失败
	StateUnknown              // 未知
	StatePending              // 等待
	StatePaused               // 挂起
	StateSkipped              // 跳过
	StateAll     State = -1
)

func (*State) OrUnknown

func (s *State) OrUnknown() State

OrUnknown returns the pointed-to state, or StateUnknown if s is nil.

Jump to

Keyboard shortcuts

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