Added table columns and table names as anonymous struct

This commit is contained in:
Guy Tish 2017-06-26 14:14:16 +03:00 committed by Alex Grintsvayg
parent 99a3a1d091
commit 23f245776d
2 changed files with 19 additions and 0 deletions

View file

@ -17,6 +17,16 @@ type {{$modelName}} struct {
{{end -}}
}
var {{$modelName}}Columns = struct {
{{range $column := .Table.Columns -}}
{{titleCase $column.Name}} string
{{end -}}
}{
{{range $column := .Table.Columns -}}
{{titleCase $column.Name}}: "{{$column.Name}}",
{{end -}}
}
// {{$modelName}}Filter allows you to filter on any columns by making them all pointers.
type {{$modelName}}Filter struct {
{{range $column := .Table.Columns -}}

View file

@ -0,0 +1,9 @@
var TableNames = struct {
{{range $table := .Tables -}}
{{titleCase $table.Name}} string
{{end -}}
}{
{{range $table := .Tables -}}
{{titleCase $table.Name}}: "{{$table.Name}}",
{{end -}}
}