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

Add raw joda time encoding to quill-async #837

Merged
merged 1 commit into from
Jul 15, 2017
Merged

Conversation

mosyp
Copy link
Collaborator

@mosyp mosyp commented Jul 15, 2017

Fixes #836

Problem

Async driver support joda time by default but raw encoders are missing

Solution

  • Add raw encoder/decoder for joda types
  • Provide implicit mapped encoding for other date types (java 8).

Notes

Breaking Changes!
java.time.LocalDate now supports only date sql types, java.time.LocalDateTime - only timestamp sql types. Joda times follow this conventions accordingly.

Exception is made to java.util.Date it supports both date and timestamp types due to historical moments (java.sql.Timestamp extents java.util.Date)

Checklist

  • Unit test all changes
  • Update README.md if applicable
  • Add [WIP] to the pull request title if it's work in progress
  • Squash commits that aren't meaningful changes
  • Run sbt scalariformFormat test:scalariformFormat to make sure that the source files are formatted

@getquill/maintainers

@mosyp
Copy link
Collaborator Author

mosyp commented Jul 15, 2017

@getquill/maintainers I guess we need breaking-changes label so we can easily catch them up at future releases, but I don't know how to add them :)

Copy link
Contributor

@mxl mxl left a comment

Choose a reason for hiding this comment

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

Everything looks good. Just few pedantic comments.

"decode local date time types" in {
case class DateEncodingTestEntity(v1: LocalDateTime, v2: LocalDateTime, v3: LocalDateTime)
"decode local date types and local date time type" in {
case class DateEncodingTestEntity(v1: LocalDate, v2: LocalDateTime, v3: LocalDateTime)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you remove v3 field? It duplicates v2.
Also it's better to change test name to "decode LocalDate and LocalDateTime types".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

v3 has different sql type so let's keep it, to double-sure everything's ok

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, did not notice that.

"decode local date types" in {
case class DateEncodingTestEntity(v1: LocalDate, v2: LocalDate, v3: LocalDate)
val entity = DateEncodingTestEntity(LocalDate.now, LocalDate.now, LocalDate.now)
"encodes joda local date and local date time type" in {
Copy link
Contributor

Choose a reason for hiding this comment

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

May be change it to "decode joda LocalDate and LocalDateTime types" just for consistency with other tests names and correct class names?

"encodes localdate type" in {
case class DateEncodingTestEntity(v1: LocalDate, v2: LocalDate)
val entity = DateEncodingTestEntity(LocalDate.now, LocalDate.now)
"encodes joda localdate and localdatetime type" in {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use correct case for class name here - LocalDate and LocalDateTime. WDYT?

"encodes localdatetime type" in {
case class DateEncodingTestEntity(v1: LocalDateTime, v2: LocalDateTime)
val entity = DateEncodingTestEntity(LocalDateTime.now, LocalDateTime.now)
"encodes localdate and localdatetime type" in {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure!

@mosyp mosyp merged commit 0768ff1 into zio:master Jul 15, 2017
@mosyp mosyp deleted the async-joda branch October 9, 2017 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants