2022-01-15 13:08:34 +08:00
|
|
|
package main
|
|
|
|
|
2022-01-19 19:39:04 +08:00
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"fmt"
|
|
|
|
"go.dedis.ch/protobuf"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QueryCondition struct {
|
|
|
|
Page *int
|
|
|
|
Size *int
|
|
|
|
QueryMap map[string]string
|
|
|
|
}
|
|
|
|
|
|
|
|
type (
|
|
|
|
ints []int
|
|
|
|
strs []string
|
|
|
|
scripts []Script
|
|
|
|
)
|
|
|
|
|
|
|
|
type Script struct {
|
|
|
|
ScriptName string `json:"script_name" gorm:"column:script_name"`
|
|
|
|
ScriptIntro string `json:"script_intro" gorm:"column:script_intro"`
|
|
|
|
ScriptTag ints `json:"script_tag" gorm:"column:script_tag"`
|
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Scripts struct {
|
|
|
|
Scripts scripts `json:"scripts" `
|
|
|
|
}
|
|
|
|
|
|
|
|
type (
|
|
|
|
Tag struct {
|
|
|
|
Value string `json:"value" gorm:"column:value"`
|
|
|
|
Uuid int `json:"uuid" gorm:"primary_key" valid:"no_empty"`
|
|
|
|
IsDel int `json:"-" gorm:"column:is_del" value:"1|0"`
|
|
|
|
Cs []Category `json:"categories,omitempty" gorm:"many2many:c_tag;foreignKey:Uuid;joinForeignKey:TagUid;References:Uuid;JoinReferences:CategoryUid" valid:"no_empty"`
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
Category struct {
|
|
|
|
Value string `json:"value" gorm:"column:value"`
|
|
|
|
Uuid string `json:"uuid" gorm:"primary_key" valid:"no_empty"`
|
|
|
|
IsDel int `json:"-" gorm:"column:is_del"`
|
|
|
|
Tags []Tag `json:"tags,omitempty" gorm:"many2many:c_tag;foreignKey:Uuid;joinForeignKey:CategoryUid;References:Uuid;JoinReferences:TagUid" valid:"no_empty"`
|
|
|
|
}
|
|
|
|
)
|
2022-01-15 13:08:34 +08:00
|
|
|
|
|
|
|
func main() {
|
2022-01-19 19:39:04 +08:00
|
|
|
w := &bytes.Buffer{}
|
|
|
|
types := []interface{}{
|
|
|
|
Tag{},
|
|
|
|
Category{},
|
|
|
|
}
|
|
|
|
err := protobuf.GenerateProtobufDefinition(w, types, nil, nil)
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
fmt.Println(w.String())
|
|
|
|
|
2022-01-15 13:08:34 +08:00
|
|
|
}
|