2016-09-03 21:47:27 +02:00
|
|
|
{{if .Table.IsJoinTable -}}
|
|
|
|
{{else -}}
|
2016-06-20 07:22:50 +02:00
|
|
|
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
|
|
|
|
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
|
2016-06-20 01:29:59 +02:00
|
|
|
var (
|
2016-09-14 10:08:30 +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 ", "}}{{"}"}}
|
2016-06-20 01:29:59 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
2016-09-14 10:08:30 +02:00
|
|
|
{{$tableNameSingular}}Slice []*{{$tableNameSingular}}
|
|
|
|
{{if eq .NoHooks false -}}
|
|
|
|
{{$tableNameSingular}}Hook func(boil.Executor, *{{$tableNameSingular}}) error
|
|
|
|
{{- end}}
|
2016-07-14 07:09:05 +02:00
|
|
|
|
2016-09-14 10:08:30 +02:00
|
|
|
{{$varNameSingular}}Query struct {
|
|
|
|
*boil.Query
|
|
|
|
}
|
2016-06-20 01:29:59 +02:00
|
|
|
)
|
2016-08-28 16:12:37 +02:00
|
|
|
|
2016-09-03 21:24:18 +02:00
|
|
|
// Cache for insert and update
|
|
|
|
var (
|
2016-09-14 10:08:30 +02:00
|
|
|
{{$varNameSingular}}Type = reflect.TypeOf(&{{$tableNameSingular}}{})
|
|
|
|
{{$varNameSingular}}Mapping = boil.MakeStructMapping({{$varNameSingular}}Type)
|
|
|
|
{{$varNameSingular}}InsertCacheMut sync.RWMutex
|
|
|
|
{{$varNameSingular}}InsertCache = make(map[string]insertCache)
|
|
|
|
{{$varNameSingular}}UpdateCacheMut sync.RWMutex
|
|
|
|
{{$varNameSingular}}UpdateCache = make(map[string]updateCache)
|
2016-09-03 21:24:18 +02:00
|
|
|
)
|
|
|
|
|
2016-08-28 16:12:37 +02:00
|
|
|
// Force time package dependency for automated UpdatedAt/CreatedAt.
|
|
|
|
var _ = time.Second
|
2016-09-03 21:47:27 +02:00
|
|
|
{{end -}}
|