msgpack icon indicating copy to clipboard operation
msgpack copied to clipboard

feat: added `RegisterBinaryExt` helper

Open giautm opened this issue 2 years ago • 1 comments

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

giautm avatar Nov 11 '23 14:11 giautm

cc @vmihailenco, Can you please take a look?

giautm avatar Nov 16 '23 16:11 giautm