msgpack
msgpack copied to clipboard
feat: added `RegisterBinaryExt` helper
Support for MarshalBinary only helpful when the user need to encode the value. But it lose all type information, then when they need to decode it back from bytes into any, it can't decode correctly. The only way to do that is register the type with RegisterExt* methods
The real use-case for this PR is support for decimal.Decimal package
func init() {
RegisterBinaryExt[decimal.Decimal](1)
}
See: https://github.com/vmihailenco/msgpack/issues/324
cc @vmihailenco, Can you please take a look?