From 81c406bb60c5d70e03e2f7dc597cedfb5ec6a9ba Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 4 May 2021 20:20:39 +0200 Subject: [PATCH] :tada: Add db/inet type factory. --- backend/src/app/db.clj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/app/db.clj b/backend/src/app/db.clj index 75412606d..b9886ec7e 100644 --- a/backend/src/app/db.clj +++ b/backend/src/app/db.clj @@ -333,6 +333,12 @@ (t/decode-str val) val))) +(defn inet + [ip-addr] + (doto (org.postgresql.util.PGobject.) + (.setType "inet") + (.setValue (str ip-addr)))) + (defn tjson "Encode as transit json." [data]