Sha256: 60a1038b97ed2f67741736fe3fd9765df7be2522e8574b1f5690870d50fb4ad5

Contents?: true

Size: 384 Bytes

Versions: 16

Compression:

Stored size: 384 Bytes

Contents

<%-
err_type_name = "InvalidEnumName"
err_type = packages.type_for(err_type_name)
if err_type
  import err_type.package
-%>

func StringTo<%= type.name %>(s string) (<%= type.name %>, error) {
  val, ok := <%= type.name %>NameToValue[s]
  if ok {
    return val, nil
  } else {
    err := &<%= err_type.qualified_name %>{Name: s}
    return <%= type.name %>(0), err
  }
}
<%-
end
-%>

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
goon_model_gen-0.4.3 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.4.2 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.4.1 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.4.0 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.3.1 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.3.0 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.2.5 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.2.4 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.2.3 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.2.2 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.2.1 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.2.0 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.1.3 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.1.2 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.1.1 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb
goon_model_gen-0.1.0 lib/goon_model_gen/templates/model/enum/05_StringTo.go.erb