model

package
v0.0.0-...-96d424b Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        int `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Model

type Model struct {
	// contains filtered or unexported fields
}

func New

func New() *Model

func (*Model) AutoMigrate

func (m *Model) AutoMigrate()

AutoMigrate 数据库自动迁移.

func (*Model) CreateTask

func (m *Model) CreateTask(task Task) error

CreateTask.

func (*Model) GetTaskList

func (m *Model) GetTaskList() (list []*Task, err error)

GetTaskList 获取任务列表.

func (*Model) QueryTaskById

func (m *Model) QueryTaskById(id int) (task Task, err error)

QueryTaskById 根据id查询任务.

func (*Model) UpdateTaskStatusById

func (m *Model) UpdateTaskStatusById(taskid int, status TaskStatus) error

UpdateTaskStatusById 根据任务id更改任务状态.

type ModelConfig

type ModelConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	Name     string
}

type Task

type Task struct {
	Base
	SlotID     int        `json:"slot_id" gorm:"slot_id"`       //插槽id.
	MigrateIP  string     `json:"migrate_ip" gorm:"migrate_ip"` //插槽所在的ip.
	TargetIP   string     `json:"target_ip" gorm:"target_ip"`   //迁移到ip.
	Status     TaskStatus `json:"status" gorm:"stats"`          //任务状态.
	StatusName string     `json:"-" gorm:"-"`                   //任务状态.
	EndAt      string     `json:"end_at" gorm:"end_at"`         //任务结束时间.
}

func (*Task) SwitchTaskStatus

func (task *Task) SwitchTaskStatus()

func (*Task) TableName

func (t *Task) TableName() string

TableName .

type TaskStatus

type TaskStatus int

type User

type User struct {
	Base
	Account  string
	Name     string
	Password string
}

func (*User) TableName

func (u *User) TableName() string

TableName.

Jump to

Keyboard shortcuts

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