Fix names of txt helper functions in templates

This commit is contained in:
Aaron L 2016-09-18 11:18:43 -07:00
parent 4e20f223cd
commit f00230c414
16 changed files with 16 additions and 16 deletions

View file

@ -2,7 +2,7 @@
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $varNameSingular := .ForeignKey.ForeignTable | singular | camelCase -}}
// {{$txt.Function.Name}}G pointed to by the foreign key.
func ({{$txt.Function.Receiver}} *{{$txt.LocalTable.NameGo}}) {{$txt.Function.Name}}G(mods ...qm.QueryMod) {{$varNameSingular}}Query {

View file

@ -4,7 +4,7 @@
{{- $table := .Table -}}
{{- range .Table.ToManyRelationships -}}
{{- $varNameSingular := .ForeignTable | singular | camelCase -}}
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
{{- $rel := txtsFromToMany $dot.Tables $table . -}}
{{- $schemaForeignTable := .ForeignTable | $dot.SchemaTable -}}
// {{$rel.Function.Name}}G retrieves all the {{$rel.LocalTable.NameSingular}}'s {{$rel.ForeignTable.NameHumanReadable}}
{{- if not (eq $rel.Function.Name $rel.ForeignTable.NamePluralGo)}} via {{.ForeignColumn}} column{{- end}}.

View file

@ -2,7 +2,7 @@
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $varNameSingular := $dot.Table.Name | singular | camelCase -}}
{{- $arg := printf "maybe%s" $txt.LocalTable.NameGo -}}
{{- $slice := printf "%sSlice" $txt.LocalTable.NameGo}}

View file

@ -4,7 +4,7 @@
{{- $dot := . -}}
{{- range .Table.ToManyRelationships -}}
{{- $varNameSingular := $dot.Table.Name | singular | camelCase -}}
{{- $txt := textsFromRelationship $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromToMany $dot.Tables $dot.Table . -}}
{{- $arg := printf "maybe%s" $txt.LocalTable.NameGo -}}
{{- $slice := printf "%sSlice" $txt.LocalTable.NameGo -}}
{{- $schemaForeignTable := .ForeignTable | $dot.SchemaTable}}

View file

@ -3,7 +3,7 @@
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $varNameSingular := .ForeignKey.ForeignTable | singular | camelCase -}}
{{- $localNameSingular := .ForeignKey.Table | singular | camelCase}}
// Set{{$txt.Function.Name}} of the {{.ForeignKey.Table | singular}} to the related item.

View file

@ -5,7 +5,7 @@
{{- $table := .Table -}}
{{- range .Table.ToManyRelationships -}}
{{- $varNameSingular := .ForeignTable | singular | camelCase -}}
{{- $rel := textsFromRelationship $dot.Tables $table . -}}
{{- $rel := txtsFromToMany $dot.Tables $table . -}}
{{- $localNameSingular := .Table | singular | camelCase -}}
{{- $foreignNameSingular := .ForeignTable | singular | camelCase}}
// Add{{$rel.Function.Name}} adds the given related objects to the existing relationships

View file

@ -28,7 +28,7 @@ func ({{.Function.Receiver}} *{{.LocalTable.NameGo}}) {{.Function.Name}}(exec bo
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- template "relationship_to_one_helper" (preserveDot $dot $txt) -}}
{{- end -}}
{{- end -}}

View file

@ -91,7 +91,7 @@ func ({{$varNameSingular}}L) Load{{.Function.Name}}(e boil.Executor, singular bo
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- template "relationship_to_one_eager_helper" (preserveDot $dot $txt) -}}
{{- end -}}
{{end}}

View file

@ -124,7 +124,7 @@ func ({{.Function.Receiver}} *{{.LocalTable.NameGo}}) Remove{{.Function.Name}}(e
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- template "relationship_to_one_setops_helper" (preserveDot $dot $txt) -}}
{{- end -}}
{{- end -}}

View file

@ -70,7 +70,7 @@ func test{{.LocalTable.NameGo}}ToOne{{.ForeignTable.NameGo}}_{{.Function.Name}}(
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- template "relationship_to_one_test_helper" (preserveDot $dot $txt) -}}
{{end -}}
{{- end -}}

View file

@ -159,7 +159,7 @@ func test{{.LocalTable.NameGo}}ToOneRemoveOp{{.ForeignTable.NameGo}}_{{.Function
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table .}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table .}}
{{template "relationship_to_one_setops_test_helper" (preserveDot $dot $txt) -}}
{{- end -}}
{{- end -}}

View file

@ -3,7 +3,7 @@
{{- $dot := . }}
{{- $table := .Table }}
{{- range .Table.ToManyRelationships -}}
{{- $rel := textsFromRelationship $dot.Tables $table .}}
{{- $rel := txtsFromToMany $dot.Tables $table .}}
func test{{$rel.LocalTable.NameGo}}ToMany{{$rel.Function.Name}}(t *testing.T) {
var err error
tx := MustTx(boil.Begin())

View file

@ -5,7 +5,7 @@
{{- range .Table.ToManyRelationships -}}
{{- $varNameSingular := .Table | singular | camelCase -}}
{{- $foreignVarNameSingular := .ForeignTable | singular | camelCase -}}
{{- $rel := textsFromRelationship $dot.Tables $table .}}
{{- $rel := txtsFromToMany $dot.Tables $table .}}
func test{{$rel.LocalTable.NameGo}}ToManyAddOp{{$rel.Function.Name}}(t *testing.T) {
var err error

View file

@ -2,7 +2,7 @@
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table . -}}
func test{{$txt.LocalTable.NameGo}}ToOne{{$txt.ForeignTable.NameGo}}_{{$txt.Function.Name}}(t *testing.T) {
tx := MustTx(boil.Begin())
defer tx.Rollback()

View file

@ -2,7 +2,7 @@
{{- else -}}
{{- $dot := . -}}
{{- range .Table.FKeys -}}
{{- $txt := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table .}}
{{- $txt := txtsFromFKey $dot.PkgName $dot.Tables $dot.Table .}}
{{- $varNameSingular := .ForeignKey.Table | singular | camelCase -}}
{{- $foreignVarNameSingular := .ForeignKey.ForeignTable | singular | camelCase}}
func test{{$txt.LocalTable.NameGo}}ToOneSetOp{{$txt.ForeignTable.NameGo}}_{{$txt.Function.Name}}(t *testing.T) {

View file

@ -141,7 +141,7 @@ type TxtToMany struct {
}
}
// textsFromRelationship creates a struct that does a lot of the text
// txtsFromToMany creates a struct that does a lot of the text
// transformation in advance for a given relationship.
func txtsFromToMany(tables []bdb.Table, table bdb.Table, rel bdb.ToManyRelationship) TxtToMany {
r := TxtToMany{}