struct.go.tpl 388 B

1234567891011121314151617
  1. package {{.Models}}
  2. {{$ilen := len .Imports}}
  3. {{if gt $ilen 0}}
  4. import (
  5. {{range .Imports}}"{{.}}"{{end}}
  6. )
  7. {{end}}
  8. {{range .Tables}}
  9. type {{Mapper .Name}} struct {
  10. {{$table := .}}
  11. {{range .ColumnsSeq}}{{$col := $table.GetColumn .}} {{Mapper $col.Name}} {{Type $col}} `meddler:"{{$col.Name}}{{if $col.IsPrimaryKey}},pk{{end}}{{if $col.Nullable}},zeroisnull{{end}}"`
  12. {{end}}
  13. }
  14. {{end}}