-
Notifications
You must be signed in to change notification settings - Fork 217
Closed
Description
I'm only beginning my journey with Korma so pardon me if I'm being pathetically dumb. :)
I found the following behaviour to be very counter-intuitive:
(defentity user
(entity-fields :id :name))
(->
(select* user)
(fields :id)
(as-sql))
The result is:
=> SELECT "user"."id", "user"."name", "user"."id" FROM "user"
Note that user.id appears twice! I definitely expected the call to fields to let me create a list of fields for the SELECT statement. Instead, it vconcats them to the default fields in entity (:fields user).
Of course one can dissoc the defaults like this:
(->
(select* user)
(dissoc :fields)
(fields :id)
(as-sql))
=> SELECT "user"."id" FROM "user"
This is a bit cumbersome and not quite something you expect to write.
So, is there a more idiomatic way to do what I need or is it something that the library could improve upon?
Metadata
Metadata
Assignees
Labels
No labels