Fix template errors

This commit is contained in:
Patrick O'brien 2016-08-05 15:03:37 +10:00
parent feb85a2a44
commit b1b0607123
3 changed files with 12 additions and 12 deletions

View file

@ -6,22 +6,22 @@ func ({{.Function.Receiver}} *{{.LocalTable.NameGo}}) {{.Function.Name}}G(mods .
// {{.Function.Name}}GP pointed to by the foreign key. Panics on error.
func ({{.Function.Receiver}} *{{.LocalTable.NameGo}}) {{.Function.Name}}GP(mods ...qm.QueryMod) *{{.ForeignTable.NameGo}} {
o, err := {{.Function.Receiver}}.{{.Function.Name}}(boil.GetDB(), mods...)
slice, err := {{.Function.Receiver}}.{{.Function.Name}}(boil.GetDB(), mods...)
if err != nil {
panic(boil.WrapErr(err))
}
return o
return slice
}
// {{.Function.Name}}P pointed to by the foreign key with exeuctor. Panics on error.
func ({{.Function.Receiver}} *{{.LocalTable.NameGo}}) {{.Function.Name}}P(exec boil.Executor, mods ...qm.QueryMod) *{{.ForeignTable.NameGo}} {
o, err := {{.Function.Receiver}}.{{.Function.Name}}(exec, mods...)
slice, err := {{.Function.Receiver}}.{{.Function.Name}}(exec, mods...)
if err != nil {
panic(boil.WrapErr(err))
}
return o
return slice
}
// {{.Function.Name}} pointed to by the foreign key.

View file

@ -16,23 +16,23 @@ func ({{$rel.Function.Receiver}} *{{$rel.LocalTable.NameGo}}) {{$rel.Function.Na
// {{$rel.Function.Name}}GP panics on error. Retrieves all the {{$rel.LocalTable.NameSingular}}'s {{$rel.ForeignTable.NameHumanReadable}}
{{- if not (eq $rel.Function.Name $rel.ForeignTable.NamePluralGo)}} via {{.ForeignColumn}} column{{- end}}.
func ({{$rel.Function.Receiver}} *{{$rel.LocalTable.NameGo}}) {{$rel.Function.Name}}GP(mods ...qm.QueryMod) {{$rel.ForeignTable.Slice}} {
o, err := {{$rel.Function.Receiver}}.{{$rel.Function.Name}}(boil.GetDB(), mods...)
slice, err := {{$rel.Function.Receiver}}.{{$rel.Function.Name}}(boil.GetDB(), mods...)
if err != nil {
panic(boil.WrapErr(err))
}
return o
return slice
}
// {{$rel.Function.Name}}P panics on error. Retrieves all the {{$rel.LocalTable.NameSingular}}'s {{$rel.ForeignTable.NameHumanReadable}} with an executor
{{- if not (eq $rel.Function.Name $rel.ForeignTable.NamePluralGo)}} via {{.ForeignColumn}} column{{- end}}.
func ({{$rel.Function.Receiver}} *{{$rel.LocalTable.NameGo}}) {{$rel.Function.Name}}P(exec boil.Executor, mods ...qm.QueryMod) {{$rel.ForeignTable.Slice}} {
o, err := {{$rel.Function.Receiver}}.{{$rel.Function.Name}}(exec, mods...)
slice, err := {{$rel.Function.Receiver}}.{{$rel.Function.Name}}(exec, mods...)
if err != nil {
panic(boil.WrapErr(err))
}
return o
return slice
}
// {{$rel.Function.Name}} retrieves all the {{$rel.LocalTable.NameSingular}}'s {{$rel.ForeignTable.NameHumanReadable}} with an executor

View file

@ -11,12 +11,12 @@ func {{$tableNameSingular}}FindG({{$pkArgs}}, selectCols ...string) (*{{$tableNa
// {{$tableNameSingular}}FindGP retrieves a single record by ID, and panics on error.
func {{$tableNameSingular}}FindGP({{$pkArgs}}, selectCols ...string) *{{$tableNameSingular}} {
o, err := {{$tableNameSingular}}Find(boil.GetDB(), {{$pkNames | join ", "}}, selectCols...)
retobj, err := {{$tableNameSingular}}Find(boil.GetDB(), {{$pkNames | join ", "}}, selectCols...)
if err != nil {
panic(boil.WrapErr(err))
}
return o
return retobj
}
// {{$tableNameSingular}}Find retrieves a single record by ID with an executor.
@ -43,10 +43,10 @@ func {{$tableNameSingular}}Find(exec boil.Executor, {{$pkArgs}}, selectCols ...s
// {{$tableNameSingular}}FindP retrieves a single record by ID with an executor, and panics on error.
func {{$tableNameSingular}}FindP(exec boil.Executor, {{$pkArgs}}, selectCols ...string) *{{$tableNameSingular}} {
o, err := {{$tableNameSingular}}Find(exec, {{$pkNames | join ", "}}, selectCols...)
retobj, err := {{$tableNameSingular}}Find(exec, {{$pkNames | join ", "}}, selectCols...)
if err != nil {
panic(boil.WrapErr(err))
}
return o
return retobj
}