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
How do you know I didn't want to legitimately encode the string "$10"? It seems quite surprising if that secretly gets corrupted to whatever symbol happens to have ID 10. EncodeAs is not meant to be a low-level API, it's precisely for cases like this where you want to encode a value as a specific, non-default Ion type.
[edit: ahhh, low-level since it's EncodeAs not MarshalAs, I'm very likely an idiot. :) I'd be fine adding a MarshalAs function if it'd be useful for folks.]
When marshalling symbols, e.g., $10, marshalling writes this out as a string. It should be writing this out as a symbol. Refer to: https://github.com/amzn/ion-go/blob/7c7b14b9dac9034d4831ffebbf4d4c54273b5447/ion/marshal.go#L172
There is encodeAs https://github.com/amzn/ion-go/blob/7c7b14b9dac9034d4831ffebbf4d4c54273b5447/ion/marshal.go#L129, but this seems to be a low level API.
Proposal would be for marshal to detect symbols and write it out as a symbol.
The text was updated successfully, but these errors were encountered: