Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions templates/go/model_enum.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// {{{classname}}} {{{description}}}{{^description}}the model '{{{classname}}}'{{/description}}
type {{{classname}}} {{{format}}}{{^format}}{{dataType}}{{/format}}
type {{{classname}}} {{dataType}}

// List of {{{name}}}
const (
Expand All @@ -22,7 +22,7 @@ var Allowed{{{classname}}}EnumValues = []{{{classname}}}{
}

func (v *{{{classname}}}) UnmarshalJSON(src []byte) error {
var value {{{format}}}{{^format}}{{dataType}}{{/format}}
var value {{dataType}}
err := json.Unmarshal(src, &value)
if err != nil {
return err
Expand All @@ -45,7 +45,7 @@ func (v *{{{classname}}}) UnmarshalJSON(src []byte) error {

// New{{{classname}}}FromValue returns a pointer to a valid {{{classname}}}
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func New{{{classname}}}FromValue(v {{{format}}}{{^format}}{{dataType}}{{/format}}) (*{{{classname}}}, error) {
func New{{{classname}}}FromValue(v {{dataType}}) (*{{{classname}}}, error) {
ev := {{{classname}}}(v)
if ev.IsValid() {
return &ev, nil
Expand Down
Loading