| 123456789101112131415161718192021222324252627 |
- // 自动生成模板{{.StructName}}
- package {{.Package}}
- import (
- "log-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 }}
|