From 4c804677804c748487e50d9917c0d5ddb917b03b Mon Sep 17 00:00:00 2001 From: Pavel Merzlyakov Date: Fri, 6 Dec 2024 18:27:57 +0300 Subject: [PATCH] data_root DeleteCollections method --- tpl/macros_struct.twig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tpl/macros_struct.twig b/tpl/macros_struct.twig index 4b45f11..6ebb235 100644 --- a/tpl/macros_struct.twig +++ b/tpl/macros_struct.twig @@ -1012,4 +1012,15 @@ func Delete{{ s.name }}Diff(ctx context.Context, dbe metadb.Execer, ids {{ s.nam {%~ endfor %} return nil } + +func Delete{{ s.name }}Collections(ctx context.Context, dbe metadb.Execer, {{ delete_by|varname }} {{ delete_by.type|go_type }}) error { + {%~ for f in ctx.fields %} + {%~ if f.type is array %} + if err := Delete{{ f.type.value.name }}Collection(ctx, dbe, {{ delete_by|varname }}); err != nil { + return err + } + {%~ endif %} + {%~ endfor %} + return nil +} {% endmacro root_delete %}