Skip to content

Add insertUnique_ to PersistUniqueWrite - #1469

Merged
parsonsmatt merged 4 commits into
yesodweb:masterfrom
lbseale:insertUnique
Mar 3, 2023
Merged

Add insertUnique_ to PersistUniqueWrite#1469
parsonsmatt merged 4 commits into
yesodweb:masterfrom
lbseale:insertUnique

Conversation

@lbseale

@lbseale lbseale commented Jan 27, 2023

Copy link
Copy Markdown
Contributor

Before submitting your PR, check that you've:

  • Documented new APIs with Haddock markup
  • Added @since declarations to the Haddock
  • Ran stylish-haskell on any changed files.
  • Adhered to the code style (see the .editorconfig file for details)

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Bumped the version number if there isn't an (unreleased) on the Changelog
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

- Works the same as insertUnique, but doesn't return a key
- For SQL databases this can be twice as fast since there is no SELECT
  to get the key after the original INSERT

commit 093b2347762e15a12fc4422c718d6adeb3e7fb89
Author: Luke Seale <19484084+lbseale@users.noreply.github.com>
Date:   Tue Jan 24 17:33:41 2023 -0800

    Add a test for insertUnique_

commit 75ffc4f3eb5048d1983fab6d8b0df22e1d6f4517
Author: Luke Seale <19484084+lbseale@users.noreply.github.com>
Date:   Tue Jan 24 17:33:19 2023 -0800

    Add help for insertUnique_

    - Also fix incorrect type annotation

commit bc81b359f454d0984062ab4f32980df75a6a85d8
Author: Luke Seale <19484084+lbseale@users.noreply.github.com>
Date:   Tue Jan 24 17:31:50 2023 -0800

    Add insertUnique_ to PersistUniqueWrite typeclass

    - Works the same way is insertUnique, but calls insert_ instead of
      insert
    - Return type is Maybe (), since it insert_ doesn't return a key
@lbseale

lbseale commented Jan 27, 2023

Copy link
Copy Markdown
Contributor Author

Fixes issue #1457

@parsonsmatt parsonsmatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you! Please make a Changelog entry. I'll relesae this with 2.14.5.0

--
-- Linus's record was inserted to <#dataset-persist-unique-1 dataset-1>, while SPJ wasn't because SPJ already exists in <#dataset-persist-unique-1 dataset-1>.
--
-- @since 2.14.4.4

@parsonsmatt parsonsmatt Mar 2, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an addition to a class with a default method, this is a minor version bump - let's bundle this with 2.14.5.0.

@parsonsmatt parsonsmatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@parsonsmatt
parsonsmatt merged commit 20f6914 into yesodweb:master Mar 3, 2023
@lbseale

lbseale commented Mar 3, 2023

Copy link
Copy Markdown
Contributor Author

Thank you! Proud to have my contribution included

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants