crud
crud copied to clipboard
Add update_object operation
Please add update_object operation similarly to upsert_object: https://github.com/tarantool/crud#upsert
The reason why there is insert_object, replace_object and upsert_object and no update_object and delete_object is as follows.
The syntax for insert/replace is space:insert(tuple)/space:replace(tuple). upsert is replace+update, so its syntax is space:upsert(tuple, ops). For insert, replace and upsert it is expected that user should provide a tuple since one may not exist yet.
On the other hand, the syntax for update/delete is index:update(key, ops)/space:delete(key). It is expected that tuple should already exist, so it may be accessed by its key. The object isn't used here, so there is no corresponding _object method yet. On the other hand, we may implement primary key extraction from the key-value object.
Two separate questions could be considered here:
- allowing to specify index key with
{key = value}map forupdateanddelete(throughupdate_objectanddelete_object), - allowing to use non-primary index for
updateanddelete.
I think we'll discuss these features with product team and then decide either we should or shouldn't support them.
On the other hand, we may implement primary key extraction from the key-value object.
That's the purpose of the issue.