sqlboiler/templates/00_struct.tpl
Aaron L 307fe4919a Add parsing routine for SQL from/join statements
- Bonus: Add yaml/toml struct tags for models
2016-08-05 23:51:13 -07:00

8 lines
431 B
Smarty

{{- $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}}" toml:"{{$column.Name}}" yaml:"{{$column.Name}}"`
{{end -}}
}