datalevin 2025-05-31

Using 0.9.22, Writing a java.time.Instant for a value that is :db/valueType :db.type/instant fails with "class java.time.Instant cannot be cast to class java.util.Date". It appears this is because

(defn coerce-inst
  [v]
  (cond
    (inst? v)    v
    (integer? v) (Date. (long v))
    :else        (raise "Expect java.util.Date" {:input v})))
looks like maybe (= java.time.Instant (class v)) (Date/from v) before the (inst? v) clause would be ok. There maybe better ways. I assume the implementation needs to keep java.util.Date.

My apologies I have not followed up yet. I have not forgotten.

Right, looks like inst? return true for java.sql.Timestamp, java.sql.Date and java.time.Instant , so we need to coerce all these to Date PR welcome

👍 1

hi @huahaiy Ran into this today. I've created a PR https://github.com/datalevin/datalevin/pull/374 Not sure where you might want me to add any tests.

A test would be nicer. Thanks.

sure. where would you recommend i put it? not super familiar with the code base. Should I create a ns datalevin.prepare-test?

datalevin.test.validation

✔️ 1