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

Redo field traversal #29

Open
phemmer opened this issue Apr 28, 2015 · 0 comments
Open

Redo field traversal #29

phemmer opened this issue Apr 28, 2015 · 0 comments

Comments

@phemmer
Copy link
Owner

phemmer commented Apr 28, 2015

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant