From a8c8da34b2e0be52ef77cbfd7caf6338920a09ac Mon Sep 17 00:00:00 2001 From: Pavel Merzlyakov Date: Thu, 8 Jun 2023 09:56:02 +0300 Subject: [PATCH] fix order pkey fields --- tpl/macro.twig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tpl/macro.twig b/tpl/macro.twig index c46cfa6..79e63b4 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -19,8 +19,10 @@ {% macro decl_struct(o, extra = '') %} -{% set pkey_fields = token(o, 'table_pkey')|split(',') %} -{% set pkey = o.fields|filter(f => f.name in pkey_fields ) %} + {% if has_token(o, 'table') %} + {% set pkey_fields = token(o, 'table_pkey')|split(',') %} + {% set pkey = pkey_fields|map(f => o.fields[f]) %} + {% endif %} {%- if o.parent and has_token(o, 'POD') -%} {{Error("@POD structs can't have a parent: " ~ o.name)}} -- 2.34.1