generated from pkg/go-template
feat :
This commit is contained in:
@@ -1,7 +1,75 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
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"`
|
||||
}
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("我是个示例")
|
||||
w := &bytes.Buffer{}
|
||||
types := []interface{}{
|
||||
Tag{},
|
||||
Category{},
|
||||
}
|
||||
err := protobuf.GenerateProtobufDefinition(w, types, nil, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(w.String())
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user