Reputation: 11764
Is there a neat way to save a Date into a Datomic attribute of type db.type/instant? For instance, there is a d/tempid and d/squuid functions to produce a tempid and a squuid.
Upvotes: 4
Views: 1154
Reputation: 1665
Datomic doesn't provide an API endpoint for generating dates as opposed to the cases for tempid
(something Datomic makes a specific use of) and squuid
(the generated value is changed from a standard uuid
and will leak time information, which precludes some secure use, but allows for better indexing performance).
In Clojure code you can use the #inst
reader literal or (java.util.Date.). You can obviously use the java.util.Date
constructor in Java code as well (or use a library that generates the same type).
Upvotes: 4