bitemyapp / bitemyapp/esqueleto
Support using `insertSelect` with an entire `Entity`
- Dominant language
- Haskell
- Stars
- 399
- Forks
- 107
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 1
Description
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`](https://dev.mysql.com/doc/refman/8.0/en/replace.html), as in #86, but it's otherwise the same idea.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the insertSelect and Insertion APIs, then compare them with Persistent's insertEntityMany. Determine how the PersistEntity constraint and the types of (<#) and (<&>) prevent inserting an entire Entity, including its primary key, from a SELECT query. Done means a safe API, possibly insertSelectEntity, supports that use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100