proxy.golang.org : github.com/twmb/go-mergetyp
Package mergetyp can generate a relatively fast future proof function to merge two arbitrary types. If you have ever had to write a function to merge a structure, only to add fields to the structure later, this package may benefit you. The Gen function can generate a merge function that will skip potentially nested fields as appropriate. The speed of the function is slightly slower than a native inline function, but not terribly so (for one of my structs, the generated merge was 3.3x slower, from 60ns to 200ns). Using Gen can help future proof merging changes when the struct may grow over time. Further, the field blacklisting functionality can eliminate batches of tedious code. Recursive types are supported, as is skipping fields selectively in recursive types until a base limit. It is not yet possible to skip a field forever while recursing.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/twmb/go-mergetyp
License: MIT
Latest release: over 3 years ago
First release: over 3 years ago
Namespace: github.com/twmb
Stars: 1 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 2 months ago