Skip to content

Conversation

@brigadier
Copy link

@brigadier brigadier commented Mar 11, 2021

Allow encoding terms containing tuples with the [tuples_to_lists] option of the encode function. Tuples are encoded as lists. No exception is made for the [{}] and [{k, v}, ...] special cases, and in the current implementation DateTime objects are also encoded as lists.

The rationale for this pull is that in newer erlang projects structures represeting key -> value pairs generally move from proplists to maps, encode and decode functions are not invertible anyway, and transforming manually each and every tuple to list manually before encoding is a tedious job.

Without this option it is fully compatible with previous versions.

I can also add conversion of one-tuple and two-tuple to timestamps, but not sure if this should be default behaviour or a configurable with another paremeter(s) one.

brigadier and others added 3 commits March 11, 2021 22:55
Co-authored-by: Paulo F. Oliveira <[email protected]>
Co-authored-by: Paulo F. Oliveira <[email protected]>
Co-authored-by: Paulo F. Oliveira <[email protected]>
@brigadier
Copy link
Author

brigadier commented Mar 11, 2021

I'd add that this pull is not ready for getting accepted yet until I add support for datetimes and some tests. It's here for discussing about whether should it be accepted or not.

@paulo-ferraz-oliveira
Copy link
Contributor

You can convert this to a draft if you think it better signals your intention.

brigadier and others added 2 commits March 12, 2021 09:29
Co-authored-by: Paulo F. Oliveira <[email protected]>
Co-authored-by: Paulo F. Oliveira <[email protected]>
@brigadier brigadier marked this pull request as draft March 12, 2021 06:30
@brigadier brigadier marked this pull request as ready for review March 13, 2021 14:13
… C} and {{A, B, C}, {D, E, F}} to datetime. Converts to lists instead.
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.

2 participants