You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
982 B
23 lines
982 B
6 months ago
|
// 自动生成模板{{.StructName}}
|
||
|
package model
|
||
|
|
||
|
import (
|
||
|
"bkb-seller/global"
|
||
|
)
|
||
|
|
||
|
// 如果含有time.Time 请自行import time包
|
||
|
type {{.StructName}} struct {
|
||
|
global.GVA_MODEL {{- range .Fields}}
|
||
|
{{- if eq .FieldType "bool" }}
|
||
|
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- end }}"`
|
||
|
{{- else }}
|
||
|
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if eq .FieldType "string" -}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}}{{- end -}};{{- if ne .FieldType "string" -}}{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}{{- end -}}"`
|
||
|
{{- end }} {{- end }}
|
||
|
}
|
||
|
|
||
|
{{ if .TableName }}
|
||
|
func ({{.StructName}}) TableName() string {
|
||
|
return "{{.TableName}}"
|
||
|
}
|
||
|
{{ end }}
|