Skip to content
Permalink
Browse files

Add coast/find-by :table {:where "clause"}

  • Loading branch information...
swlkr committed Mar 19, 2019
1 parent d699993 commit 9979087e7b23db3bcf79377340dbabf4255bd536
Showing with 12 additions and 1 deletion.
  1. +2 −1 src/coast.clj
  2. +10 −0 src/coast/db.clj
@@ -39,7 +39,8 @@
first!
pluck
fetch
execute!]
execute!
find-by]

[coast.db.connection
connection]
@@ -237,6 +237,16 @@
:id id}))))


(defn find-by [k m]
(when (and (ident? k)
(map? m))
(first
(q [:select :*
:from k
:where (map identity m)
:limit 1]))))


(defn select-rels [m]
(let [schema (db.schema/fetch)]
(select-keys m (->> (:joins schema)

0 comments on commit 9979087

Please sign in to comment.
You can’t perform that action at this time.