From b4470182201e6f9d28c13e6a7a0d1b76c01647ff Mon Sep 17 00:00:00 2001 From: Aaron L Date: Sun, 17 Jul 2016 17:52:55 -0700 Subject: [PATCH] Rename ReverseArgs -> ReverseInserts - Remove debug comment --- templates/04_relationship_to_one.tpl | 1 - templates_test/relationship_to_one.tpl | 2 +- text_helpers.go | 8 ++++---- text_helpers_test.go | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/templates/04_relationship_to_one.tpl b/templates/04_relationship_to_one.tpl index dd4f60e..7303b4a 100644 --- a/templates/04_relationship_to_one.tpl +++ b/templates/04_relationship_to_one.tpl @@ -48,7 +48,6 @@ func ({{.Function.Receiver}} *{{.LocalTable.NameGo}}) {{.Function.Name}}X(exec b {{- $dot := . -}} {{- range .Table.FKeys -}} {{- $rel := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}} -// TO_ONE {{- template "relationship_to_one_helper" $rel -}} {{end -}} {{- end -}} diff --git a/templates_test/relationship_to_one.tpl b/templates_test/relationship_to_one.tpl index 749027f..d6bf392 100644 --- a/templates_test/relationship_to_one.tpl +++ b/templates_test/relationship_to_one.tpl @@ -13,7 +13,7 @@ func Test{{.LocalTable.NameGo}}ToOne{{.ForeignTable.NameGo}}_{{.Function.Name}}( {{end}} - {{if not .Function.ReverseArgs -}} + {{if not .Function.ReverseInserts -}} if err := foreign.InsertX(tx); err != nil { t.Fatal(err) } diff --git a/text_helpers.go b/text_helpers.go index d84ef34..bef1b11 100644 --- a/text_helpers.go +++ b/text_helpers.go @@ -28,9 +28,9 @@ type RelationshipToOneTexts struct { PackageName string Name string - Varname string - Receiver string - ReverseArgs bool + Varname string + Receiver string + ReverseInserts bool LocalAssignment string ForeignAssignment string @@ -88,7 +88,7 @@ func textsFromOneToOneRelationship(packageName string, tables []bdb.Table, table rel := textsFromForeignKey(packageName, tables, table, fkey) rel.Function.Name = strmangle.TitleCase(strmangle.Singular(toMany.ForeignTable)) - rel.Function.ReverseArgs = true + rel.Function.ReverseInserts = true return rel } diff --git a/text_helpers_test.go b/text_helpers_test.go index fa22b43..2e2153a 100644 --- a/text_helpers_test.go +++ b/text_helpers_test.go @@ -92,7 +92,7 @@ func TestTextsFromForeignKey(t *testing.T) { expect.Function.Name = "User" expect.Function.Varname = "user" expect.Function.Receiver = "v" - expect.Function.ReverseArgs = false + expect.Function.ReverseInserts = false expect.Function.LocalAssignment = "UserID.Int32" expect.Function.ForeignAssignment = "ID" @@ -138,7 +138,7 @@ func TestTextsFromOneToOneRelationship(t *testing.T) { expect.Function.Name = "Video" expect.Function.Varname = "video" expect.Function.Receiver = "u" - expect.Function.ReverseArgs = true + expect.Function.ReverseInserts = true expect.Function.LocalAssignment = "ID" expect.Function.ForeignAssignment = "UserID.Int32"