Skip to content
This repository was archived by the owner on Aug 12, 2019. It is now read-only.
This repository was archived by the owner on Aug 12, 2019. It is now read-only.

Redo field traversal #29

@phemmer

Description

@phemmer

Right now, deStruct traverses fields recursively, makes copies, scalars, and children objects. This is rather difficult, and complex. We really shouldn't try to maintain near identical copies of the input data. Instead we should convert it to a basic, but simple interface all handlers can consume.

One option:
Redo this so that there are no copies, and all objects are converted into a field type. The field should have:

  • Type method which indicates the original type of the field
  • Name the key for the field
  • Scalar method which returns a scalar value
  • String method which returns a string of the scalar value
  • SubFields method which returns a nested map of sub fields
  • Fields method which returns a flattened map of sub fields, including the field itself
  • MarshalJSON self explanatory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions