Skip to content

Adds delete function at a class level - enables instances of models to be deleted without reading them first #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 15, 2022

Conversation

simonprickett
Copy link
Contributor

@simonprickett simonprickett commented Feb 14, 2022

This pull request adds a delete function to HashModel and JsonModel - so you can delete something you know the pk for without first having to read it from Redis.

So you can now do... (where Person is a HashModel but could be a JsonModel):

    Person.delete(pk)

before you had to do this:

    person = Person.get(pk)
    person.delete()

I've added a couple of tests too.

Closes #127

@simonprickett simonprickett added the enhancement New feature or request label Feb 14, 2022
@simonprickett simonprickett self-assigned this Feb 14, 2022
@simonprickett simonprickett requested review from chayim and removed request for chayim February 14, 2022 20:51
@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2022

Codecov Report

Merging #132 (6d009a0) into main (2be0174) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #132      +/-   ##
==========================================
+ Coverage   77.20%   77.31%   +0.10%     
==========================================
  Files          12       12              
  Lines        1154     1155       +1     
==========================================
+ Hits          891      893       +2     
+ Misses        263      262       -1     
Flag Coverage Δ
unit 77.31% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aredis_om/model/model.py 86.36% <100.00%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2be0174...6d009a0. Read the comment docs.

@simonprickett simonprickett merged commit 09a3599 into main Feb 15, 2022
@simonprickett simonprickett deleted the delete-without-read-#127 branch February 15, 2022 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting a record shouldn't require reading it first
2 participants