Sha256: f9b2e2b88019257ba7a0b46432d7372e121612161a502ad0bc1e303526362395
Contents?: true
Size: 704 Bytes
Versions: 12
Compression:
Stored size: 704 Bytes
Contents
<%- import converter_package model = type.map[:model].type gen_type = type.map[:gen_type].type mappings = type.memo['mappings'] || [] requires_context = mappings.any?(&:requires_context) arg_def_prefix = requires_context ? 'ctx context.Context, ' : nil arg_prefix = requires_context ? 'ctx, ' : nil -%> func <%= gen_type.name %>ToModel(<%= arg_def_prefix %>payload *<%= gen_type.qualified_name(dependencies) %>) (*<%= model.qualified_name %>, error) { if payload == nil { return nil, <%= converter_package.name %>.NoPayloadGiven } var m <%= model.qualified_name %> if err := <%= gen_type.name %>AssignModel(<%= arg_prefix %>payload, &m); err != nil { return nil, err } return &m, nil }
Version data entries
12 entries across 12 versions & 1 rubygems