Fork me on GitHub
#datahike
<
2021-02-22
>
Casey09:02:37

Is there a recommended pattern for using java.time/instant throughout an application but persisting values with the supported java.util.Date?

timo10:02:55

Hi @U70QFSCG2 I don't know of a recommended pattern. Sorry.

zane17:02:58

What kinds of things would you want to see in such a guide? Help with the conversion? Something else?

Casey10:02:28

Well, it's relatively simple to write wrappers around query/pull and transact to transform those fields, don't need a guide for that necessarily. But I was hoping for a way to provide converters or something so datahike could handle it itself. I'm not sure how this is handled by datomic users, haven't been in that ecosystem at all.

timo12:02:51

Hi @U70QFSCG2. I am a contributor/maintainer for Datahike. We are happy to take PRs if you see the need and think that it would be helpful for others in the future.

whilo17:02:00

@U70QFSCG2 We have not done any work to incorporate java.time/instant and I am not very familiar with this type. Is there a fallback mechanism in Java that we could easily hook into to treat instants as Dates? For us it is important to use time types that are instants in Clojure, if this is true for java.time/instant then we should extend our schema to support it on the JVM. Can you open an issue?

Casey17:02:20

by java.time/instant , I mean the java class _java_._time_._Instant_ which is part of the java time api released as part of java 8. Since 2015 or so we haven't used java.util.Date pretty much anywhere, but migrated fully to java.time.Instant. > Is there a fallback mechanism in Java that we could easily hook into to treat instants as Dates? Not sure what this would look like, so I can't rightfully say.