Rename ReverseArgs -> ReverseInserts
- Remove debug comment
This commit is contained in:
parent
d4170806f5
commit
b447018220
4 changed files with 7 additions and 8 deletions
|
@ -48,7 +48,6 @@ func ({{.Function.Receiver}} *{{.LocalTable.NameGo}}) {{.Function.Name}}X(exec b
|
||||||
{{- $dot := . -}}
|
{{- $dot := . -}}
|
||||||
{{- range .Table.FKeys -}}
|
{{- range .Table.FKeys -}}
|
||||||
{{- $rel := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
|
{{- $rel := textsFromForeignKey $dot.PkgName $dot.Tables $dot.Table . -}}
|
||||||
// TO_ONE
|
|
||||||
{{- template "relationship_to_one_helper" $rel -}}
|
{{- template "relationship_to_one_helper" $rel -}}
|
||||||
{{end -}}
|
{{end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -13,7 +13,7 @@ func Test{{.LocalTable.NameGo}}ToOne{{.ForeignTable.NameGo}}_{{.Function.Name}}(
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
||||||
{{if not .Function.ReverseArgs -}}
|
{{if not .Function.ReverseInserts -}}
|
||||||
if err := foreign.InsertX(tx); err != nil {
|
if err := foreign.InsertX(tx); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,9 @@ type RelationshipToOneTexts struct {
|
||||||
PackageName string
|
PackageName string
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
Varname string
|
Varname string
|
||||||
Receiver string
|
Receiver string
|
||||||
ReverseArgs bool
|
ReverseInserts bool
|
||||||
|
|
||||||
LocalAssignment string
|
LocalAssignment string
|
||||||
ForeignAssignment string
|
ForeignAssignment string
|
||||||
|
@ -88,7 +88,7 @@ func textsFromOneToOneRelationship(packageName string, tables []bdb.Table, table
|
||||||
|
|
||||||
rel := textsFromForeignKey(packageName, tables, table, fkey)
|
rel := textsFromForeignKey(packageName, tables, table, fkey)
|
||||||
rel.Function.Name = strmangle.TitleCase(strmangle.Singular(toMany.ForeignTable))
|
rel.Function.Name = strmangle.TitleCase(strmangle.Singular(toMany.ForeignTable))
|
||||||
rel.Function.ReverseArgs = true
|
rel.Function.ReverseInserts = true
|
||||||
return rel
|
return rel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ func TestTextsFromForeignKey(t *testing.T) {
|
||||||
expect.Function.Name = "User"
|
expect.Function.Name = "User"
|
||||||
expect.Function.Varname = "user"
|
expect.Function.Varname = "user"
|
||||||
expect.Function.Receiver = "v"
|
expect.Function.Receiver = "v"
|
||||||
expect.Function.ReverseArgs = false
|
expect.Function.ReverseInserts = false
|
||||||
|
|
||||||
expect.Function.LocalAssignment = "UserID.Int32"
|
expect.Function.LocalAssignment = "UserID.Int32"
|
||||||
expect.Function.ForeignAssignment = "ID"
|
expect.Function.ForeignAssignment = "ID"
|
||||||
|
@ -138,7 +138,7 @@ func TestTextsFromOneToOneRelationship(t *testing.T) {
|
||||||
expect.Function.Name = "Video"
|
expect.Function.Name = "Video"
|
||||||
expect.Function.Varname = "video"
|
expect.Function.Varname = "video"
|
||||||
expect.Function.Receiver = "u"
|
expect.Function.Receiver = "u"
|
||||||
expect.Function.ReverseArgs = true
|
expect.Function.ReverseInserts = true
|
||||||
|
|
||||||
expect.Function.LocalAssignment = "ID"
|
expect.Function.LocalAssignment = "ID"
|
||||||
expect.Function.ForeignAssignment = "UserID.Int32"
|
expect.Function.ForeignAssignment = "UserID.Int32"
|
||||||
|
|
Loading…
Reference in a new issue