Ensure that relationship structs aren't clobbered
- There was no thought put in if a relationship struct already existed when it went to be used a second time so it was being clobbered. - Fix #39
This commit is contained in:
parent
42681453a9
commit
3046214fb6
3 changed files with 18 additions and 6 deletions
|
@ -22,11 +22,15 @@ func ({{$varNameSingular}}L) Load{{$txt.Function.Name}}(e boil.Executor, singula
|
|||
|
||||
args := make([]interface{}, count)
|
||||
if singular {
|
||||
object.R = &{{$varNameSingular}}R{}
|
||||
if object.R == nil {
|
||||
object.R = &{{$varNameSingular}}R{}
|
||||
}
|
||||
args[0] = object.{{$txt.LocalTable.ColumnNameGo}}
|
||||
} else {
|
||||
for i, obj := range slice {
|
||||
obj.R = &{{$varNameSingular}}R{}
|
||||
if obj.R == nil {
|
||||
obj.R = &{{$varNameSingular}}R{}
|
||||
}
|
||||
args[i] = obj.{{$txt.LocalTable.ColumnNameGo}}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,15 @@ func ({{$varNameSingular}}L) Load{{$txt.Function.Name}}(e boil.Executor, singula
|
|||
|
||||
args := make([]interface{}, count)
|
||||
if singular {
|
||||
object.R = &{{$varNameSingular}}R{}
|
||||
if object.R == nil {
|
||||
object.R = &{{$varNameSingular}}R{}
|
||||
}
|
||||
args[0] = object.{{$txt.LocalTable.ColumnNameGo}}
|
||||
} else {
|
||||
for i, obj := range slice {
|
||||
obj.R = &{{$varNameSingular}}R{}
|
||||
if obj.R == nil {
|
||||
obj.R = &{{$varNameSingular}}R{}
|
||||
}
|
||||
args[i] = obj.{{$txt.LocalTable.ColumnNameGo}}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,11 +23,15 @@ func ({{$varNameSingular}}L) Load{{$txt.Function.Name}}(e boil.Executor, singula
|
|||
|
||||
args := make([]interface{}, count)
|
||||
if singular {
|
||||
object.R = &{{$varNameSingular}}R{}
|
||||
if object.R == nil {
|
||||
object.R = &{{$varNameSingular}}R{}
|
||||
}
|
||||
args[0] = object.{{.Column | titleCase}}
|
||||
} else {
|
||||
for i, obj := range slice {
|
||||
obj.R = &{{$varNameSingular}}R{}
|
||||
if obj.R == nil {
|
||||
obj.R = &{{$varNameSingular}}R{}
|
||||
}
|
||||
args[i] = obj.{{.Column | titleCase}}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue