Skip to content

Rename fields when generating map encodings#46

Open
hannahhoward wants to merge 1 commit intowhyrusleeping:masterfrom
hannahhoward:feat/rename-map-fields
Open

Rename fields when generating map encodings#46
hannahhoward wants to merge 1 commit intowhyrusleeping:masterfrom
hannahhoward:feat/rename-map-fields

Conversation

@hannahhoward
Copy link
Copy Markdown
Contributor

Goals

Allow using keys other than the actual field name when generating map encodings.

Implementation

If a struct field has a tag with key "json", use that as the "name" for the field when generating a map encoder as opposed to the actual field's name. (otherwise just use the name)

This has a number of potential uses:

  1. using shorter key names for size concerns
  2. being able to rename struct fields without breaking compatibility with old versions.

if a struct field has a tag with key "json", use that in generating a map encoder as opposed to the
var name --> allows field renames on map encoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant