Fix struct tag generation.

- Clean up template
This commit is contained in:
Aaron L 2016-08-03 22:34:46 -07:00
parent 9503acaf8e
commit a1b14f4eae

View file

@ -1,8 +1,8 @@
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
{{- $dbName := singular .Table.Name -}}
// {{$tableNameSingular}} is an object representing the database table.
type {{$tableNameSingular}} struct {
{{range $key, $value := .Table.Columns -}}
{{titleCase $value.Name}} {{$value.Type}} `db:"{{makeDBName $dbName $value.Name}}" json:"{{$value.Name}}"`
{{- $tableNameSingular := .Table.Name | singular -}}
{{- $modelName := $tableNameSingular | titleCase -}}
// {{$modelName}} is an object representing the database table.
type {{$modelName}} struct {
{{range $column := .Table.Columns -}}
{{titleCase $column.Name}} {{$column.Type}} `boil:"{{printf "%s.%s" $tableNameSingular $column.Name}}" json:"{{$column.Name}}"`
{{end -}}
}