增加自动化代码文件组件

This commit is contained in:
piexlMax
2023-06-09 22:10:18 +08:00
parent a9d0531a56
commit b17b56dba0
11 changed files with 252 additions and 70 deletions
@@ -4,6 +4,7 @@ package {{.Package}}
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
{{ if .HasTimer }}"time"{{ end }}
{{ if .HasFile }}"gorm.io/datatypes"{{ end }}
)
// {{.StructName}} 结构体
@@ -13,6 +14,8 @@ type {{.StructName}} struct {
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};type:enum({{.DataTypeLong}});comment:{{.Comment}};"`
{{- else if eq .FieldType "picture" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`
{{- else if eq .FieldType "file" }}
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`
{{- else if ne .FieldType "string" }}
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}"`
{{- else }}