Add binary map key and shimming #398
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds directive
maps//msgp:maps binkeys|shim|autoshimNot adding the directive will retain current behaviour where maps without string keys are ignored.
Adding
binkeyswill allow for binary marshaling of map keys. Types are inferred with standard rules. Binary encoding can be shimmed and can return any standard type. See_generated/map_bin_key.gofor examples.Adding
shimwill require you to add shims to custom map key types. Shims must be with string type. See_generated/map_shim_key.gofor examples.Adding
autoshimwill add automatic shimming to map keys that areuint, uint8, uint16, uint32, uint64, int, int8, int16, int32, int64, bool, float32, float64, byte- so these are written as a string. Standardstrconv.Parse/Formatfunctions are used. Aliased types are not supported, butmsgp:replace MyInt with:intdirective can be used and this will be picked up.Adds
witherr:true|falseto//msgp:shimdirectives, so shim de-serializing can return errors.Updates/Resolves: #331 #345 #305 #257 #232
Quirks: