Remove unused template variables
This commit is contained in:
parent
cbb7041748
commit
b0cdc29c61
4 changed files with 5 additions and 11 deletions
|
@ -4,10 +4,9 @@
|
||||||
{{- $dot := . -}}
|
{{- $dot := . -}}
|
||||||
{{- $table := .Table -}}
|
{{- $table := .Table -}}
|
||||||
{{- range .Table.ToManyRelationships -}}
|
{{- range .Table.ToManyRelationships -}}
|
||||||
{{- $varNameSingular := .ForeignTable | singular | camelCase -}}
|
|
||||||
{{- $rel := txtsFromToMany $dot.Tables $table . -}}
|
{{- $rel := txtsFromToMany $dot.Tables $table . -}}
|
||||||
{{- $localNameSingular := .Table | singular | camelCase -}}
|
{{- $varNameSingular := .Table | singular | camelCase -}}
|
||||||
{{- $foreignNameSingular := .ForeignTable | singular | camelCase}}
|
{{- $foreignVarNameSingular := .ForeignTable | singular | camelCase}}
|
||||||
// Add{{$rel.Function.Name}} adds the given related objects to the existing relationships
|
// Add{{$rel.Function.Name}} adds the given related objects to the existing relationships
|
||||||
// of the {{$table.Name | singular}}, optionally inserting them as new records.
|
// of the {{$table.Name | singular}}, optionally inserting them as new records.
|
||||||
// Appends related to o.R.{{$rel.Function.Name}}.
|
// Appends related to o.R.{{$rel.Function.Name}}.
|
||||||
|
@ -50,7 +49,7 @@ func (o *{{$rel.LocalTable.NameGo}}) Add{{$rel.Function.Name}}(exec boil.Executo
|
||||||
{{end -}}
|
{{end -}}
|
||||||
|
|
||||||
if o.R == nil {
|
if o.R == nil {
|
||||||
o.R = &{{$localNameSingular}}R{
|
o.R = &{{$varNameSingular}}R{
|
||||||
{{$rel.Function.Name}}: related,
|
{{$rel.Function.Name}}: related,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -60,7 +59,7 @@ func (o *{{$rel.LocalTable.NameGo}}) Add{{$rel.Function.Name}}(exec boil.Executo
|
||||||
{{if .ToJoinTable -}}
|
{{if .ToJoinTable -}}
|
||||||
for _, rel := range related {
|
for _, rel := range related {
|
||||||
if rel.R == nil {
|
if rel.R == nil {
|
||||||
rel.R = &{{$foreignNameSingular}}R{
|
rel.R = &{{$foreignVarNameSingular}}R{
|
||||||
{{$rel.Function.ForeignName}}: {{$rel.LocalTable.NameGo}}Slice{{"{"}}o{{"}"}},
|
{{$rel.Function.ForeignName}}: {{$rel.LocalTable.NameGo}}Slice{{"{"}}o{{"}"}},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,7 +69,7 @@ func (o *{{$rel.LocalTable.NameGo}}) Add{{$rel.Function.Name}}(exec boil.Executo
|
||||||
{{else -}}
|
{{else -}}
|
||||||
for _, rel := range related {
|
for _, rel := range related {
|
||||||
if rel.R == nil {
|
if rel.R == nil {
|
||||||
rel.R = &{{$foreignNameSingular}}R{
|
rel.R = &{{$foreignVarNameSingular}}R{
|
||||||
{{$rel.Function.ForeignName}}: o,
|
{{$rel.Function.ForeignName}}: o,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
|
|
||||||
{{- $tableNamePlural := .Table.Name | plural | titleCase -}}
|
{{- $tableNamePlural := .Table.Name | plural | titleCase -}}
|
||||||
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
|
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
|
||||||
// {{$tableNamePlural}}G retrieves all records.
|
// {{$tableNamePlural}}G retrieves all records.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
|
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
|
||||||
{{- $dbName := singular .Table.Name -}}
|
|
||||||
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
|
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
|
||||||
{{- $colDefs := sqlColDefinitions .Table.Columns .Table.PKey.Columns -}}
|
{{- $colDefs := sqlColDefinitions .Table.Columns .Table.PKey.Columns -}}
|
||||||
{{- $pkNames := $colDefs.Names | stringMap .StringFuncs.camelCase -}}
|
{{- $pkNames := $colDefs.Names | stringMap .StringFuncs.camelCase -}}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
|
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
|
||||||
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
|
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
|
||||||
{{- $colDefs := sqlColDefinitions .Table.Columns .Table.PKey.Columns -}}
|
|
||||||
{{- $pkNames := $colDefs.Names | stringMap .StringFuncs.camelCase -}}
|
|
||||||
{{- $pkArgs := joinSlices " " $pkNames $colDefs.Types | join ", " -}}
|
|
||||||
{{- $schemaTable := .Table.Name | .SchemaTable -}}
|
{{- $schemaTable := .Table.Name | .SchemaTable -}}
|
||||||
// UpdateG a single {{$tableNameSingular}} record. See Update for
|
// UpdateG a single {{$tableNameSingular}} record. See Update for
|
||||||
// whitelist behavior description.
|
// whitelist behavior description.
|
||||||
|
|
Loading…
Reference in a new issue