splice update operation now supports varbinary
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 15
- Forks
- 49
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 3
Description
Related dev. issue(s): https://github.com/tarantool/tarantool/issues/9997
Related doc. issue(s): https://github.com/tarantool/doc/issues/3551 (should be fixed before https://github.com/tarantool/doc/issues/4237)
Product: Tarantool
Since: 3.2.0
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/update/
SME: @ alyapunov
Details
Just in case splice is an update operation that can modify string
field, deleting a part of it and inserting something instead.
tarantool> box.tuple.new{'1234567'}:update{{':', 1, 2, 3, '!'}}
---
- ['1!567']
...
In the this example splice operation ':' takes field 1 of tuple,
takes position 2 in string, removes 3 symbols and inserts '!' to
that position.
Both deletion and insertion can naturally degrade to no-op.
Before this patch a splice operation required both field and
inserting argument to be strings.
This patch allows the field and the argument to be varbinary.
tarantool> varb = require('varbinary')
tarantool> t = box.tuple.new{varb.new('1234567')}
tarantool> t:update{{':', 1, 2, 3, varb.new('!')}}
---
- [!!binary MSE1Njc=]
...
That also allows to insert strings into varbinary fields and
insert varbinary data into string. The actual field type after
update such operation remains the same, so updated string will
be string, while updated varbinary will be varbinary.
Closes #9997
Requested by @ alyapunov in https://github.com/tarantool/tarantool/commit/aaa0ad0c25d5dcf566897d926eb5d1d37c1ed72a.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the root document for box.space.update and review related doc issue #3551 first, as requested in the issue. Document splice support for varbinary, including mixed string and varbinary insertion and preservation of the updated field type, with the examples shown. Done means the update reference covers the behavior introduced in Tarantool 3.2.0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100