Test the to_one eager loading.
This commit is contained in:
parent
3ecb8f96c0
commit
e3ff48e647
1 changed files with 15 additions and 0 deletions
|
@ -40,6 +40,21 @@ func test{{.LocalTable.NameGo}}ToOne{{.ForeignTable.NameGo}}_{{.Function.Name}}(
|
|||
if check.{{.Function.ForeignAssignment}} != foreign.{{.Function.ForeignAssignment}} {
|
||||
t.Errorf("want: %v, got %v", foreign.{{.Function.ForeignAssignment}}, check.{{.Function.ForeignAssignment}})
|
||||
}
|
||||
|
||||
if err = local.Relationships.Load{{.Function.Name}}(tx, false, {{.LocalTable.NameGo}}Slice{&local}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if local.Relationships.{{.Function.Name}} == nil {
|
||||
t.Error("struct should have been eager loaded")
|
||||
}
|
||||
|
||||
local.Relationships.{{.Function.Name}} = nil
|
||||
if err = local.Relationships.Load{{.Function.Name}}(tx, true, &local); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if local.Relationships.{{.Function.Name}} == nil {
|
||||
t.Error("struct should have been eager loaded")
|
||||
}
|
||||
}
|
||||
|
||||
{{end -}}
|
||||
|
|
Loading…
Reference in a new issue