Use the cached relationship information
This commit is contained in:
parent
488e203c0b
commit
fc5bbc3e2e
3 changed files with 3 additions and 4 deletions
|
@ -152,6 +152,5 @@ var templateFunctions = template.FuncMap{
|
|||
"columnNames": bdb.ColumnNames,
|
||||
"columnTypes": bdb.ColumnTypes,
|
||||
"columnDBTypes": bdb.ColumnDBTypes,
|
||||
"toManyRelationships": bdb.ToManyRelationships,
|
||||
"defaultValues": bdb.DefaultValues,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{{- else -}}
|
||||
{{- $dot := . }}
|
||||
{{- $table := .Table }}
|
||||
{{- range toManyRelationships .Table.Name .Tables -}}
|
||||
{{- range .Table.ToManyRelationships -}}
|
||||
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
|
||||
// {{$rel.Function.Name}} retrieves all the {{$rel.LocalTable.NameSingular}}'s {{$rel.ForeignTable.NameHumanReadable}}
|
||||
{{- if not (eq $rel.Function.Name $rel.ForeignTable.NamePluralGo)}} via {{.ForeignColumn}} column{{- end}}.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{{- else -}}
|
||||
{{- $dot := . }}
|
||||
{{- $table := .Table }}
|
||||
{{- range toManyRelationships .Table.Name .Tables -}}
|
||||
{{- range .Table.ToManyRelationships -}}
|
||||
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
|
||||
func Test{{$rel.LocalTable.NameGo}}ToMany{{$rel.Function.Name}}(t *testing.T) {
|
||||
var err error
|
||||
|
@ -75,5 +75,5 @@ func Test{{$rel.LocalTable.NameGo}}ToMany{{$rel.Function.Name}}(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
{{ end -}}{{- /* range */ -}}
|
||||
{{end -}}{{- /* range */ -}}
|
||||
{{- end -}}{{- /* outer if join table */ -}}
|
||||
|
|
Loading…
Reference in a new issue