sqlboiler/templates/01_types.tpl

28 lines
1.3 KiB
Smarty
Raw Normal View History

{{- $varNameSingular := .Table.Name | singular | camelCase -}}
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
var (
2016-07-14 07:09:05 +02:00
{{$varNameSingular}}Columns = []string{{"{"}}{{.Table.Columns | columnNames | stringMap .StringFuncs.quoteWrap | join ", "}}{{"}"}}
{{$varNameSingular}}ColumnsWithoutDefault = []string{{"{"}}{{.Table.Columns | filterColumnsByDefault false | columnNames | stringMap .StringFuncs.quoteWrap | join ","}}{{"}"}}
{{$varNameSingular}}ColumnsWithDefault = []string{{"{"}}{{.Table.Columns | filterColumnsByDefault true | columnNames | stringMap .StringFuncs.quoteWrap | join ","}}{{"}"}}
{{$varNameSingular}}PrimaryKeyColumns = []string{{"{"}}{{.Table.PKey.Columns | stringMap .StringFuncs.quoteWrap | join ", "}}{{"}"}}
{{$varNameSingular}}TitleCases = map[string]string{
{{range $col := .Table.Columns | columnNames -}}
"{{$col}}": "{{titleCase $col}}",
{{end -}}
}
)
type (
{{$tableNameSingular}}Slice []*{{$tableNameSingular}}
2016-08-28 12:48:50 +02:00
{{if eq .NoHooks false -}}
2016-08-29 14:38:19 +02:00
{{$tableNameSingular}}Hook func(boil.Executor, *{{$tableNameSingular}}) error
2016-08-28 12:48:50 +02:00
{{- end}}
2016-07-14 07:09:05 +02:00
{{$varNameSingular}}Query struct {
*boil.Query
}
)
// Force time package dependency for automated UpdatedAt/CreatedAt.
var _ = time.Second