From 12c0513410b46e96448e6ea862e68e4467a3b2d0 Mon Sep 17 00:00:00 2001 From: Tit Petric Date: Thu, 5 Jul 2018 11:57:47 +0200 Subject: [PATCH] generate changelog array just for complex fields --- sam/templates/http_.tpl | 2 ++ sam/templates/http_structs.tpl | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sam/templates/http_.tpl b/sam/templates/http_.tpl index 9ebd47153..73c0fb39f 100644 --- a/sam/templates/http_.tpl +++ b/sam/templates/http_.tpl @@ -4,6 +4,8 @@ import ( "github.com/pkg/errors" ) +var _ = errors.Wrap + {foreach $calls as $call} func (*{name}) {call.name|ucfirst}(r *{name|lcfirst}{call.name|ucfirst}Request) (interface{}, error) { return nil, errors.New("Not implemented: {name}.{call.name}") diff --git a/sam/templates/http_structs.tpl b/sam/templates/http_structs.tpl index 670266066..cdf6c8a7f 100644 --- a/sam/templates/http_structs.tpl +++ b/sam/templates/http_structs.tpl @@ -25,11 +25,14 @@ func ({self} *{name}) Get{field.name}() {field.type} { return {self}.{field.name} } -func ({self} *{name}) Set{field.name}(value {field.type}) *{name} { +func ({self} *{name}) Set{field.name}(value {field.type}) *{name} {{if !$field.complex} if {self}.{field.name} != value { {self}.changed = append({self}.changed, "{field.name|strtolower}") {self}.{field.name} = value } +{else} + {self}.{field.name} = value +{/if} return {self} } {/foreach}