27 lines
1.1 KiB
Smarty
27 lines
1.1 KiB
Smarty
// 自动生成模板{{.StructName}}
|
|
package {{.Package}}
|
|
|
|
import (
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
{{ if .HasTimer }}"time"{{ end }}
|
|
)
|
|
|
|
// {{.StructName}} 结构体
|
|
type {{.StructName}} struct {
|
|
global.GVA_MODEL {{- range .Fields}}
|
|
{{- 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 -}}"`
|
|
{{- end }} {{- end }}
|
|
}
|
|
|
|
{{ if .TableName }}
|
|
// TableName {{.StructName}} 表名
|
|
func ({{.StructName}}) TableName() string {
|
|
return "{{.TableName}}"
|
|
}
|
|
{{ end }}
|