From ff2276a2c891b20d4b36f71eb136fe8e463e4774 Mon Sep 17 00:00:00 2001 From: Nick Dijkshoorn Date: Thu, 24 Aug 2023 13:54:03 +0200 Subject: [PATCH] Bugfix for issue #45: objectbox-go generator can not handle a struct with multiple lazy loaded relations --- internal/generator/go/templates/binding.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/generator/go/templates/binding.go b/internal/generator/go/templates/binding.go index 353a8888..b9334ffd 100644 --- a/internal/generator/go/templates/binding.go +++ b/internal/generator/go/templates/binding.go @@ -169,7 +169,8 @@ func ({{$entityNameCamel}}_EntityInfo) PutRelated(ob *objectbox.ObjectBox, objec if err := BoxFor{{$field.Entity.Name}}(ob).RelationReplace({{.Entity.Name}}_.{{$field.Name}}, id, object, object.(*{{$field.Entity.Name}}).{{$field.Path}}); err != nil { return err } - {{if $field.IsLazyLoaded}} } {{end}} + {{if $field.IsLazyLoaded}} } + {{end}} {{- else if $field.Property}} {{- if and (not $field.Property.IsBasicType) $field.Property.ModelProperty.RelationTarget}} if rel := {{if not $field.IsPointer}}&{{end}}object.(*{{$field.Entity.Name}}).{{$field.Path}}; rel != nil {