yesodweb / yesodweb/persistent

Version of repsert for records with custom primary keys

Open
#973 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
486
Forks
306
PR merge metrics
No merged PRs in 30d

Description

The type of repsert is (MonadIO m, PersistRecordBackend record backend) => Key record -> record -> ReaderT backend m (), if I have a record where I've specified the key is one of the fields then the first parameter is redundant - it can be computed from the record itself. It'd be a nice ergonomic improvement to have a function for that case with one less parameter. It'd be almost exactly the same as upsert, with the OnlyOneUniqueKey constraint, but not taking a list of updates to perform.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the existing repsert and upsert definitions, along with the OnlyOneUniqueKey constraint, to understand their current API and backend behavior. Done means providing a repsert variant that derives the key from the record and performs the operation without an update list, while preserving the existing constraints and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.