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 %}