Skip to content

Commit

Permalink
Convert db response keys to kebab case
Browse files Browse the repository at this point in the history
  • Loading branch information
tarun-nil committed Jan 5, 2024
1 parent eedf690 commit 67b1556
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions swift-ticketing/src/swift_ticketing/db/query.clj
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
(ns swift-ticketing.db.query
(:require [next.jdbc :as jdbc]
[next.jdbc.result-set :as rs]))
[next.jdbc.result-set :as rs]
[camel-snake-kebab.core :as csk]
[camel-snake-kebab.extras :as cske]))

(defn- run-query-with
[f db-spec query]
(f db-spec query {:builder-fn rs/as-unqualified-maps}))
(cske/transform-keys csk/->kebab-case-keyword
(f db-spec query {:builder-fn rs/as-unqualified-maps})))

(defn run-query!
[db-spec query]
(run-query-with jdbc/execute! db-spec query))
(run-query-with jdbc/execute! db-spec query))

(defn run-query-one!
[db-spec query]
(run-query-with jdbc/execute-one! db-spec query))
(run-query-with jdbc/execute-one! db-spec query))

0 comments on commit 67b1556

Please sign in to comment.