Skip to content
Snippets Groups Projects
Commit d2dfe781 authored by MarkRx's avatar MarkRx
Browse files

Change clojure.lang.Ratio honeysql to serialize as a double instead of a ratio

parent ae9da83c
Branches
Tags
No related merge requests found
......@@ -64,6 +64,12 @@
java.lang.Number
(to-sql [x] (str x)))
;; Ratios are represented as the division of two numbers which may cause order-of-operation issues when dealing with
;; queries. The easiest way around this is to convert them to their decimal representations.
(extend-protocol honeysql.format/ToSql
clojure.lang.Ratio
(to-sql [x] (hformat/to-sql (double x))))
;; HoneySQL automatically assumes that dots within keywords are used to separate schema / table / field / etc. To
;; handle weird situations where people actually put dots *within* a single identifier we'll replace those dots with
;; lozenges, let HoneySQL do its thing, then switch them back at the last second
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment