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. ////
  8. package model
  9. {{$hasGTime:=false}}
  10. {{range $index, $column := .table.Columns}}
  11. {{if eq $column.GoType "Time"}}
  12. {{$hasGTime = true}}
  13. {{end}}
  14. {{end}}
  15. {{if $hasGTime}}
  16. import "github.com/gogf/gf/os/gtime"
  17. {{end}}
  18. // {{.table.ClassName}} is the golang structure for table {{.table.TableName}}.
  19. type {{.table.ClassName}} struct {
  20. {{range $index, $column := .table.Columns}}
  21. {{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}}
  22. {{end}}
  23. }