Fork me on GitHub
#datahike
<
2021-06-26
>
stathissideris11:06:42

hello, what date objects can I store in datahike (using a file-based DB). I tried java.time.LocalDate but I get this exception:

stathissideris11:06:03

1. Caused by clojure.lang.ExceptionInfo
   Could not write key.
   {:type :write-error, :key :db, :exception #error {
    :cause "Cannot write 2018-09-17 as tag null"
    :via
    [{:type java.lang.IllegalArgumentException
      :message "Cannot write 2018-09-17 as tag null"
      :at [org.fressian.handlers.WriteHandlerLookup requireWriteHandler "WriteHandlerLookup.java" 48]}]
    :trace
    [[org.fressian.handlers.WriteHandlerLookup requireWriteHandler "WriteHandlerLookup.java" 48]
     [org.fressian.FressianWriter writeAs "FressianWriter.java" 458]
     [org.fressian.FressianWriter writeAs "FressianWriter.java" 464]
     [org.fressian.FressianWriter writeObject "FressianWriter.java" 472]

stathissideris11:06:17

java.util.Date. seems to work, but I’d like to use the newer classes

kkuehne06:06:52

Hi @U050AACJB, we are only supporting java.util.Date at the moment because we have to write checks and comparators for each new class. What kind of Date classes would you like to see in Datahike?

stathissideris06:06:18

I was thinking of using the classes Java 8 introduced to address the shortcomings of the older java.util.Date

stathissideris06:06:35

such as LocalDate, LocalTime, LocalDateTime, ZonedDateTime etc

stathissideris06:06:06

but I’m only evaluating so please don’t do any extra work on my account!

kkuehne06:06:11

No problem at all. I'm just trying to understand what kind of use cases we could cover there.

whilo23:06:21

@U050AACJB Are there functions of the newer date classes you want to use in queries? In this case you would have to explicitly convert, which is not a big hassle, but I can understand that this is inconvenient. We could provide convenience functions for that though. If you can do all your reasoning on date itself and only need to convert when inserting into Datahike then this should be straightforward.