0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Allow floats on db/interval constructor

This commit is contained in:
Andrey Antukh 2022-09-20 21:15:57 +02:00
parent ef2918a115
commit d3347a1be0

View file

@ -367,23 +367,23 @@
(.rollback conn sp))) (.rollback conn sp)))
(defn interval (defn interval
[data] [o]
(cond (cond
(integer? data) (or (integer? o)
(->> (/ data 1000.0) (float? o))
(->> (/ o 1000.0)
(format "%s seconds") (format "%s seconds")
(pginterval)) (pginterval))
(string? data) (string? o)
(pginterval data) (pginterval o)
(dt/duration? data) (dt/duration? o)
(->> (/ (.toMillis ^java.time.Duration data) 1000.0) (interval (inst-ms o))
(format "%s seconds")
(pginterval))
:else :else
(ex/raise :type :not-implemented))) (ex/raise :type :not-implemented
:hint (format "no implementation found for value %s" (pr-str o)))))
(defn decode-json-pgobject (defn decode-json-pgobject
[^PGobject o] [^PGobject o]