esqueleto icon indicating copy to clipboard operation
esqueleto copied to clipboard

Support using `insertSelect` with an entire `Entity`

Open isomorpheme opened this issue 1 year ago • 0 comments

Sometimes I want to insert entire entities into a table, from a SELECT query, including the primary key.[^1] As far as I can tell, this isn't possible with the current insertSelect & Insertion API - the PersistEntity constraint and the types of (<#) and (<&>) get in the way.

The easiest way to support this is probably with an extra insertSelectEntity, to parallel insertEntityMany from Persistent. I haven't yet tried to come up with a safe type for such a function.

[^1]: My use case right now actually involves a REPLACE, as in #86, but it's otherwise the same idea.

isomorpheme avatar Jul 07 '23 12:07 isomorpheme