diff --git a/tpl/macro.twig b/tpl/macro.twig index e0cbce8..04560bd 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -1,4 +1,3 @@ - {% macro decl_units(meta) %} {%- for u in meta.getunits ~%} @@ -17,7 +16,7 @@ {% endmacro %} -{% macro decl_struct(o, extra = '') %} +{% macro decl_struct(o, allow_diffs = true, extra = '') %} {% set pkey_fields = token(o, 'table_pkey')|split(',') %} {% set pkey = o.fields|filter(f => f.name in pkey_fields ) %} @@ -111,7 +110,7 @@ public {{_self.struct_type(o)}} {{o.name}} {{_self.base_struct_class(o)}} } {%- endif -%} -{%- if has_token(o, 'diffable') ~%} +{%- if has_token(o, 'diffable') and allow_diffs ~%} {{_self.diffable_support(o)}} {%- endif -%} @@ -378,8 +377,12 @@ public class {{o.name}} : IRpc return !no_changes; } + {% set unique_diff_units = [] %} {% for u in get_diff_related_units(o) %} - {{_self.diff_methods_for(u)}} + {% if u not in unique_diff_units %} + {{_self.diff_methods_for(u)}} + {% set unique_diff_units = unique_diff_units|merge([u]) %} + {% endif %} {% endfor %} {% endmacro %}