From 03b0125e43b6b3aab1bba4d9ca3ff0d101f5c656 Mon Sep 17 00:00:00 2001 From: Stephen Afam-Osemene Date: Thu, 17 Oct 2024 12:59:02 +0100 Subject: [PATCH] Declare err variable in InsertRel generated code --- gen/templates/models/11_rel_ops.go.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gen/templates/models/11_rel_ops.go.tpl b/gen/templates/models/11_rel_ops.go.tpl index 0ff49eb4..72ad623c 100644 --- a/gen/templates/models/11_rel_ops.go.tpl +++ b/gen/templates/models/11_rel_ops.go.tpl @@ -364,6 +364,8 @@ return nil } + var err error + {{if $rel.InsertEarly -}} inserted, err := {{$ftable.UpPlural}}.InsertMany(ctx, exec, related...) if err != nil {