Open feluelle opened 4 days ago
@JakNowy please take a look. Also, let me know where you think I should add docs about this, please.
This looks correct. However I share your opinion that ideally we would like to split that functionality into update
and update_multi
. I think in the upcoming major version we might even go further and have single update_multi
which supports both single and multiple objects, without the "allow_multiple" constraint. If you wish, you're more than welcome to add that update_multi with simplified logic. Otherwise I'm going to approve that already.
This looks correct. However I share your opinion that ideally we would like to split that functionality into
update
andupdate_multi
. I think in the upcoming major version we might even go further and have singleupdate_multi
which supports both single and multiple objects, without the "allow_multiple" constraint. If you wish, you're more than welcome to add that update_multi with simplified logic. Otherwise I'm going to approve that already.
Let's make that a separate PR.
@JakNowy where should I put docs about this?
Description
This change allows CRUD users to retrieve the updated record after performing an
update
operation by passingreturn_columns
and optionally the model to load the response into.Changes
closes: #106
return_columns
arg to theupdate
functionschema_to_select
arg to theupdate
functionreturn_as_model
arg to theupdate
functionone_or_none
arg to theupdate
functionOptional[Union[dict, BaseModel]]
return type as it now can return dataWe use the same args that we also use in other CRUD API functions to make it easier for users to understand and use them.
Tests
I have added tests for update operations returning a single row, multiple rows, with model and without (i.e.
dict
).Checklist