backend/app/brahma/service/token/internal/model/script.go

53 lines
1.9 KiB
Go
Raw Permalink Normal View History

2022-01-19 19:39:04 +08:00
package model
import (
"database/sql/driver"
"encoding/json"
)
type (
ints []int
strs []string
)
type Scripts struct {
2022-01-23 14:48:44 +08:00
ScriptName string `json:"script_name" gorm:"column:script_name"`
ScriptIntro string `json:"script_intro" gorm:"column:script_intro"`
//type json型
ScriptTag ints `json:"script_tag" gorm:"column:script_tag" type:"json"`
2022-01-19 19:39:04 +08:00
ScriptScore float64 `json:"script_score" gorm:"column:script_score"`
GroupDuration int `json:"group_duration" gorm:"column:group_duration"`
ScriptCoverUrl string `json:"script_cover_url" gorm:"column:script_cover_url"`
ScriptTextContext string `json:"script_text_context" gorm:"column:script_text_context"`
ScriptPlotScore float64 `json:"script_plot_score" gorm:"column:script_plot_score"`
ScriptImageContent strs `json:"script_image_content" gorm:"column:script_image_content"`
ScriptMalePlayer int `json:"script_male_player" gorm:"column:script_male_player"`
ScriptFemalePlayer int `json:"script_female_player" gorm:"column:script_female_player"`
ScriptDifficultDegree string `json:"script_difficult_degree" gorm:"column:script_difficult_degree"`
ScriptPlayerLimit int `json:"script_player_limit" gorm:"column:script_player_limit"`
Uuid string `json:"uuid" gorm:"column:uuid" valid:"no_empty"`
ScriptComplexScore float64 `json:"script_complex_score" gorm:"column:script_complex_score"`
Qid string `json:"qid" gorm:"column:qid"`
IsDel int `json:"-" gorm:"column:is_del"`
}
func (m *Scripts) TableName() string {
return "scripts"
}
func (p ints) Value() (driver.Value, error) {
return json.Marshal(p)
}
func (p *ints) Scan(input interface{}) error {
return json.Unmarshal(input.([]byte), &p)
}
func (p strs) Value() (driver.Value, error) {
return json.Marshal(p)
}
func (p *strs) Scan(input interface{}) error {
return json.Unmarshal(input.([]byte), &p)
}