Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added RegisterBinaryExt helper #365

Open
wants to merge 3 commits into
base: v5
Choose a base branch
from

Conversation

giautm
Copy link

@giautm giautm commented Nov 11, 2023

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: #324

@giautm giautm changed the title feat: added RegisterBinaryExt helper feat: added RegisterBinaryExt helper Nov 11, 2023
@giautm
Copy link
Author

giautm commented Nov 16, 2023

cc @vmihailenco, Can you please take a look?

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.

None yet

1 participant