I use Clojure with korma to store Clojure maps in a Mysql database, for example, to store maps with this structure:
(defentity users (table :user) (entity-fields :email :password :name))
In a table with four columns, id (implicitly defined), email , password and name .
So, when I call this piece of code, everything works fine:
(insert users (values {:email " john@example.com " :password "____hashed_passw___" :name "J"}))
The problem is that my cards may contain some keys that do not have corresponding columns in the database (and I do not want to store these values). For instance:
(insert users (values {:email " john@example.com " :password "____hashed_passw___" :name "J" :something "else"}))
Would MySQLSyntaxErrorException Unknown column 'something' in 'field list' error.
Ideally, I would like to know if there is an option in Poop in order to ignore the extra keys present on the map. The problem can be solved with dissoc - all of them when saved, but I would prefer to find out if there is a built-in way to do this before I do it (or any other better idea).
source share