sqlboiler/templates/05_all.tpl

14 lines
636 B
Smarty
Raw Normal View History

2016-03-23 07:18:41 +01:00
{{- $tableNameSingular := titleCaseSingular .Table.Name -}}
{{- $tableNamePlural := titleCasePlural .Table.Name -}}
{{- $varNameSingular := camelCaseSingular .Table.Name -}}
// {{$tableNamePlural}}All retrieves all records.
func {{$tableNamePlural}}(mods ...qm.QueryMod) {{$varNameSingular}}Query {
return {{$tableNamePlural}}X(boil.GetDB(), mods...)
}
// {{$tableNamePlural}}X retrieves all the records using an executor.
func {{$tableNamePlural}}X(exec boil.Executor, mods ...qm.QueryMod) {{$varNameSingular}}Query {
mods = append(mods, qm.Table("{{.Table.Name}}"))
return {{$varNameSingular}}Query{NewQueryX(exec, mods...)}
}