models

package
v0.0.0-...-60360ff Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTask

func AddTask(data map[string]interface{}) (id int, ok bool)

func CheckUser

func CheckUser(username, password string) bool

func CloseDB

func CloseDB()

func DeleteTask

func DeleteTask(id int) bool

func ExistTaskByID

func ExistTaskByID(id int) bool

func ExistTaskByIDAndUsername

func ExistTaskByIDAndUsername(id int, username string) bool

func GetTaskTotal

func GetTaskTotal(maps interface{}) (count int)

func UpdateTask

func UpdateTask(id int, data interface{}) bool

Types

type Model

type Model struct {
	ID         int `gorm:"primary_key" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
}

type Task

type Task struct {
	//Model
	ID         int `gorm:"AUTO_INCREMENT;primary_key;" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`

	TaskName  string `json:"task_name"`
	Content   string `json:"content"`
	CreatedBy string `json:"created_by"`
	State     int    `json:"state"`
	TaskLog   string `json:"task_log"`
	TaskUUID  string `json:"task_uuid"`
}

func GetTask

func GetTask(id int) (task Task)

func GetTasks

func GetTasks(pageNum int, pageSize int, maps interface{}) (tasks []Task)

func GetTasksInfo

func GetTasksInfo() (tasks []Task)

func (*Task) BeforeCreate

func (task *Task) BeforeCreate(scope *gorm.Scope) error

type TaskInfo

type TaskInfo struct {
	ID       int    `gorm:"AUTO_INCREMENT;primary_key;" json:"id"`
	State    int    `json:"state"`
	TaskUUID string `json:"task_uuid"`
}

type User

type User struct {
	ID       int    `gorm:"primary_key" json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

Jump to

Keyboard shortcuts

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