sqlboiler/templates/10_all.tpl
Patrick O'brien 1c8a9d2e39 Add schema feature to everything (except rels)
* Add strmangle SchemaTable helper
2016-09-09 07:23:10 +10:00

13 lines
677 B
Smarty

{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
{{- $tableNamePlural := .Table.Name | plural | titleCase -}}
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
// {{$tableNamePlural}}G retrieves all records.
func {{$tableNamePlural}}G(mods ...qm.QueryMod) {{$varNameSingular}}Query {
return {{$tableNamePlural}}(boil.GetDB(), mods...)
}
// {{$tableNamePlural}} retrieves all the records using an executor.
func {{$tableNamePlural}}(exec boil.Executor, mods ...qm.QueryMod) {{$varNameSingular}}Query {
mods = append(mods, qm.From(`{{schemaTable .DriverName .Schema .Table.Name}}`))
return {{$varNameSingular}}Query{NewQuery(exec, mods...)}
}