model.go.tpl 586 B

1234567891011121314151617
  1. // 自动生成模板{{.StructName}}
  2. package model
  3. import (
  4. "github.com/jinzhu/gorm"
  5. )
  6. // 如果含有time.Time 请自行import time包
  7. type {{.StructName}} struct {
  8. gorm.Model {{- range .Fields}}
  9. {{- if eq .FieldType "bool" }}
  10. {{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:'{{.Comment}}'"`
  11. {{- else }}
  12. {{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:'{{.Comment}}'"`
  13. {{- end }} {{- end }}
  14. }
  15. }