-
Notifications
You must be signed in to change notification settings - Fork 357
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
MySQL Java time instances #1791
Conversation
|
||
implicit val JavaTimeLocalDateTimeMeta: Meta[java.time.LocalDateTime] = | ||
Basic.oneObject( | ||
JT.Timestamp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MySQL/MariaDB has only TIMESTAMP
which behaves as if WITH TIME ZONE
, right? It is the equivalent of Java's Instant
.
So that would mean that LocalDateTime
is not suitable for TIMESTAMP
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For MySQL a DATETIME
column = JDBC Timestamp
, and a TIMESTAMP
column = JDBC Timestamp
. I've added a hack like for Postgres to treat a TIMESTAMP
column as TimestampWithTimezone
and adjusted the instances.
classOf[java.time.OffsetDateTime] | ||
) | ||
|
||
implicit val JavaTimeInstantMeta: Meta[java.time.Instant] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be the "primary" Meta instance and the one for OffsetDateTime
be derived from it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instant
isn't mentioned in the JDBC spec so drivers don't have to provide a way to convert a column to/from it. The MySQL driver errors if you ask it for an Instant
so it is implemented in terms of OffsetDateTime
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Its been 5 months and I don't use mysql. |
I'll get this through the finish line. Thanks |
|
Doesn't really matter, but may as well do this one. |
# Conflicts: # .github/workflows/ci.yml # build.sbt # modules/core/src/main/scala/doobie/util/analysis.scala
No description provided.