You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
I think it would be nice to have the library support the standard encoding.TextUnmarshaler interfaces, so when it's about to unmarshal a string into a field (which may be of its own type), it actually instantiates that type and calls its UnmarshalText() method.
This way the object we're unmarshalling to implicitly declares how it can decode data. A use case? UUIDs stored through arrays instead of strings.
I think it would be nice to have the library support the standard
encoding.TextUnmarshaler
interfaces, so when it's about to unmarshal a string into a field (which may be of its own type), it actually instantiates that type and calls itsUnmarshalText()
method.This way the object we're unmarshalling to implicitly declares how it can decode data. A use case? UUIDs stored through arrays instead of strings.
An example implementation:
The standard go json decoder also implements this if I'm not mistaken.
Opinions?
The text was updated successfully, but these errors were encountered: