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

[WIP] Refactor and support encoding to timestamp and decoding to date #58

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

caoer
Copy link

@caoer caoer commented Nov 3, 2018

I'd like to keep the model clean, without any dependency from firestore, which limits us to use Date, and not Timestamp. This PR adds an ability of it.

I also refactor and clean the code a bit.

I haven't use and test other types. gonna work on them later...

@caoer
Copy link
Author

caoer commented Nov 3, 2018

FirestoreEncoder(userInfo: [
            CodingUserInfoKey.dateEncodingStrategy:
                DateEncodingStrategy.deferredToTimestamp({ Timestamp(date: $0) })
            ])
FirestoreDecoder(userInfo: [
            CodingUserInfoKey.dateDecodingStrategy:
                DateDecodingStrategy.deferredToTimestamp
            ])

@caoer caoer closed this Nov 3, 2018
@caoer caoer reopened this Nov 3, 2018
Copy link
Owner

@alickbass alickbass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks a lot for working on this! TBH, this Pull request is massive, it is really hard to review it. Could you please split it to smaller pull requests with more concrete goals? And about cleaning up, the way the code is organized now is intentional, to reflect the structure of the JSONEncoder and JSONDecoder in apple/swift, so I would prefer to keep it as close to that as possible

@agordeev
Copy link

It'd be great to see this merged so we could map Date to Timestamp

@jimijon
Copy link

jimijon commented Feb 18, 2019

CAN WE GET THIS INTO MASTER?

@inquisitiveSoft
Copy link
Contributor

inquisitiveSoft commented Jul 19, 2019

This looks awesome. Any chance we could get this merged?
It's not that long, considering most of it is pretty boilerplate-y.

For now I think I'll make a fork, because this is such a big quality of life improvement for me

@bradleymackey
Copy link

Bump

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.

6 participants