package dao

import "server/global"

type Program struct {
	global.GVA_MODEL
	Num     string `json:"num" gorm:"comment:显示内容编号"`
	Effect  string `json:"effect" gorm:"comment:显示方式"`
	Speed   string `json:"speed" gorm:"comment:移动速度"`
	Stay    string `json:"stay" gorm:"comment:节目停留时间"`
	Total   string `json:"total" gorm:"comment:预留"`
	Color   string `json:"color" gorm:"comment:颜色"`
	Content string `json:"content" gorm:"comment:节目内容"`
}

func (Program) TableName() string {
	return "dev_program"
}

func (p Program) CreateProgram() error {
	return global.GVA_DB.Create(&p).Error
}

func (p Program) UpdateProgram() error {
	return global.GVA_DB.Model(&Program{}).Where("id = ?", p.ID).Updates(&p).Error
}
