fix saving diff for structs with pk fields only
This commit is contained in:
parent
49efdd1464
commit
857db14448
|
@ -149,8 +149,8 @@ func Save{{ ctx.s.name }}Diff(ctx context.Context, dbe metadb.Execer, rec {{ ctx
|
|||
values = append(values, rec.{{ f|fname }})
|
||||
{% endfor %}
|
||||
|
||||
{% if ctx.raw_nonpk_fields|length > 0 %}
|
||||
initUpdateLen := updateBuilder.Len()
|
||||
|
||||
{% for f in ctx.raw_nonpk_fields %}
|
||||
if rec.{{ f|fname }}Changed() {
|
||||
queryBuilder.WriteString(",`{{ f.name }}`")
|
||||
|
@ -164,6 +164,7 @@ func Save{{ ctx.s.name }}Diff(ctx context.Context, dbe metadb.Execer, rec {{ ctx
|
|||
values = append(values, rec.{{ f|fname }})
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if has_token(ctx.s, 'table_json_kv') %}
|
||||
var jsonBuilder strings.Builder
|
||||
|
|
Loading…
Reference in New Issue