reading struct fields explicitly
This commit is contained in:
parent
b079835cb3
commit
1b4defc4f7
|
@ -729,13 +729,19 @@ func (s *{{ name|default(o.name) }}) readFields(reader meta.Reader) error {
|
|||
return errors.Errorf("bad enum value `%d` for `{{ alias }}`", {{ fname }})
|
||||
}
|
||||
{% elseif type is struct %}
|
||||
if err := {{ fname }}.Read(reader); err != nil {
|
||||
if err := reader.BeginContainer("{{ alias }}"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := {{ fname }}.ReadFields(reader); err != nil {
|
||||
{% if optional %}
|
||||
return nil
|
||||
{% else %}
|
||||
return err
|
||||
{% endif %}
|
||||
}
|
||||
if err := reader.EndContainer(); err != nil {
|
||||
return err
|
||||
}
|
||||
{% elseif type is array %}
|
||||
{% set name = fname|split('.')|last %}
|
||||
{% set size_var = name|lcfirst ~ 'Size' %}
|
||||
|
|
Loading…
Reference in New Issue