自动生成代码添加枚举类型支持 (#1073)

* fieldDialog.vue feature 增加枚举字段类型支持

* model.go.tpl feature 增加枚举字段类型支持

Co-authored-by: 周海生 <zhouhaisheng@doxue.com>
This commit is contained in:
Hessian
2022-05-18 19:24:54 +08:00
committed by GitHub
co-authored by 周海生
parent 86baabc452
commit 250fcf4bd6
2 changed files with 8 additions and 2 deletions
@@ -9,7 +9,9 @@ import (
// 如果含有time.Time 请自行import time包
type {{.StructName}} struct {
global.GVA_MODEL {{- range .Fields}}
{{- if ne .FieldType "string" }}
{{- if eq .FieldType "enum" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};type:enum({{.DataTypeLong}});comment:{{.Comment}};"`
{{- else if ne .FieldType "string" }}
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`
{{- else }}
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`