models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	BaseModel
	AgentName   string `gorm:"type:varchar(600);index" json:"agent_name"`
	AgentUrl    string `gorm:"type:varchar(600);index" json:"agent_url"`
	Workspace   string `gorm:"type:text" json:"workspace"`
	Description string `gorm:"type:text" json:"description"`
	Expired     int64  `gorm:"index" json:"expired"`

	Live     bool   `json:"live" gorm:"-"`      // 是否存活
	LiveTime string `json:"live_time" gorm:"-"` // 最近在线时间
}

type AuthToken

type AuthToken struct {
	Email string    `json:"email"`
	Name  string    `json:"name"`
	Role  enum.Role `json:"role"`
}

type BaseModel

type BaseModel struct {
	ID        string         `gorm:"primarykey" json:"id"`
	CreatedAt time.Time      `gorm:"index" json:"created_at"`
	UpdatedAt time.Time      `gorm:"index" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
}

type Configuration

type Configuration struct {
	BaseModel
	SubtaskID string `gorm:"type:varchar(600);index" json:"subtask_id"`
	Filename  string `gorm:"text" json:"filename"`
	Body      string `gorm:"text" json:"body"`
}

type Instruction

type Instruction struct {
	Build  []string `json:"build"`
	Test   []string `json:"test"`
	Deploy []string `json:"deploy"`
	Reboot []string `json:"reboot"`
	Stop   []string `json:"stop"`
	Delete []string `json:"delete"`
}

type Subtasks

type Subtasks struct {
	BaseModel
	Name        string          `gorm:"type:varchar(600);index" json:"name"`     // subtasks name
	TaskID      string          `gorm:"type:varchar(600);index" json:"task_id"`  // 任务ID
	AgentID     string          `gorm:"type:varchar(600);index" json:"agent_id"` // agentID
	Branch      string          `gorm:"type:varchar(600);index" json:"branch"`   // 分支
	Action      enum.TaskAction `gorm:"type:varchar(600);index" json:"action"`   // action
	Instruction string          `gorm:"type:text" json:"instruction"`            // 指令
	Description string          `gorm:"type:text" json:"description"`
	Payload     string          `gorm:"type:text" json:"payload"` // git payload
	Disabled    bool            `gorm:"index" json:"disabled"`    // 禁用
	GitAddr     string          `gorm:"type:text"  json:"git_addr"`
	Token       string          `gorm:"type:varchar(600);index" json:"token"`
	LogID       string          `json:"log_id" gorm:"-"`     // 其他字段使用
	TaskType    enum.TaskType   `gorm:"-" json:"task_type"`  // 其他字段使用
	AgentName   string          `gorm:"-" json:"agent_name"` // 其他字段使用
}

Subtasks 子任务

type Task

type Task struct {
	BaseModel
	Name        string `gorm:"type:varchar(600);unique" json:"name"` // task name
	Token       string `gorm:"type:varchar(600);index" json:"token"` // token
	Description string `gorm:"type:text" json:"description"`
	Disabled    bool   `gorm:"index" json:"disabled"` // 禁用
}

Task 具体任务

type TaskLog

type TaskLog struct {
	BaseModel
	TaskID      string          `gorm:"type:varchar(600);index" json:"task_id"`
	TaskName    string          `gorm:"type:varchar(600)" json:"task_name"`
	SubtasksID  string          `gorm:"type:varchar(600);index" json:"subtasks_id"`
	SubtaskName string          `gorm:"type:varchar(600)" json:"subtask_name"`
	TaskType    enum.TaskType   `gorm:"type:varchar(600);index" json:"task_type"`
	TaskStatus  enum.TaskStatus `gorm:"type:varchar(600);index" json:"task_status"`
	TaskStage   enum.TaskStage  `gorm:"type:varchar(600);index" json:"task_stage"`
	Log         string          `gorm:"type:text"`
	AgentID     string          `gorm:"type:varchar(600);index" json:"agent_id"`

	DisplayTime string `gorm:"-" json:"display_time"`
}

TaskLog 任务日志

type User

type User struct {
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`

	Email    string    `gorm:"uniqueKey;type:varchar(32)" json:"email"`
	UserName string    `gorm:"type:varchar(250)" json:"user_name"`
	Password string    `gorm:"type:varchar(250)" json:"password"`
	Role     enum.Role `gorm:"type:varchar(250)" json:"role"`
}

Jump to

Keyboard shortcuts

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