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:
parent
ef2918a115
commit
d3347a1be0
1 changed files with 10 additions and 10 deletions
|
@ -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]
|
||||||
|
|
Loading…
Add table
Reference in a new issue