model.template 1.2 KB

123456789101112131415161718192021222324252627
  1. // ==========================================================================
  2. // GFast自动生成model代码,无需手动修改,重新生成会自动覆盖.
  3. // 生成日期:{{.table.CreateTime}}
  4. // 生成路径: {{.table.PackageName}}/model/{{.table.TableName}}.go
  5. // 生成人:{{.table.FunctionAuthor}}
  6. // ==========================================================================
  7. package model
  8. {{$hasGTime:=false}}
  9. {{range $index, $column := .table.Columns}}
  10. {{if eq $column.GoType "Time"}}
  11. {{$hasGTime = true}}
  12. {{end}}
  13. {{end}}
  14. {{if $hasGTime}}
  15. import "github.com/gogf/gf/os/gtime"
  16. {{end}}
  17. // {{.table.ClassName}} is the golang structure for table {{.table.TableName}}.
  18. type {{.table.ClassName}} struct {
  19. {{range $index, $column := .table.Columns}}
  20. {{if eq $column.IsPk "1"}} {{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `orm:"{{$column.ColumnName}},primary" json:"{{$column.HtmlField}}"` // {{$column.ColumnComment}} {{else}} {{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `orm:"{{$column.ColumnName}}" json:"{{$column.HtmlField}}"` // {{$column.ColumnComment}} {{end}}
  21. {{end}}
  22. }