Skip to content

Commit 90186ad

Browse files
committed
Fixes gh-877 Update by field names
1 parent 45091cd commit 90186ad

File tree

4 files changed

+18
-24
lines changed

4 files changed

+18
-24
lines changed

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
project = u'Tarantool'
4141

4242
# |release| The full version, including alpha/beta/rc tags.
43-
release = "2.2.1"
43+
release = "2.3.0"
4444
# |version| The short X.Y version.
4545
version = '.'.join(release.split('.')[0:2])
4646

doc/2.2/book/box/box_index.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -770,22 +770,19 @@ Below is a list of all ``box.index`` functions and members.
770770
771771
.. _box_index-update:
772772

773-
.. method:: update(key, {{operator, field_no, value}, ...})
773+
.. method:: update(key, {{operator, field_identifier, value}, ...})
774774

775775
Update a tuple.
776776

777777
Same as :ref:`box.space...update() <box_space-update>`,
778778
but key is searched in this index instead of primary key.
779-
This index ought to be unique.
779+
This index should be unique.
780780

781781
:param index_object index_object: an :ref:`object reference
782782
<app_server-object_reference>`.
783783
:param scalar/table key: values to be matched against the index key
784784
:param string operator: operation type represented in string
785-
:param number field_no: what field the operation will apply to. The
786-
field number can be negative, meaning the
787-
position from the end of tuple.
788-
(#tuple + negative field number + 1)
785+
:param number-or-string field_identifier: what field the operation will apply to.
789786
:param lua_value value: what value will be applied
790787

791788
:return: the updated tuple.

doc/2.2/book/box/box_space.rst

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ Below is a list of all ``box.space`` functions and members.
15181518
15191519
.. _box_space-update:
15201520

1521-
.. method:: update(key, {{operator, field_no, value}, ...})
1521+
.. method:: update(key, {{operator, field_identifier, value}, ...})
15221522

15231523
Update a tuple.
15241524

@@ -1527,7 +1527,7 @@ Below is a list of all ``box.space`` functions and members.
15271527
fragments of a field, deleting or inserting a field. Multiple
15281528
operations can be combined in a single update request, and in this
15291529
case they are performed atomically and sequentially. Each operation
1530-
requires specification of a field number. When multiple operations
1530+
requires specification of a field identifier, which is usually a number. When multiple operations
15311531
are present, the field number for each operation is assumed to be
15321532
relative to the most recent state of the tuple, that is, as if all
15331533
previous operations in a multi-operation update have already been
@@ -1547,18 +1547,18 @@ Below is a list of all ``box.space`` functions and members.
15471547
* ``#`` for deletion
15481548
* ``=`` for assignment
15491549

1550-
For ``!`` and ``=`` operations the field number can be ``-1``, meaning
1551-
the last field in the tuple.
1550+
Possible field_identifiers are:
15521551

1552+
* Positive field number. The first field is 1, the second field is 2, and so on.
1553+
* Negative field number. The last field is -1, the second-last field is -2, and so on. In other words: (#tuple + negative field number + 1).
1554+
* Name. If the space was formatted with :ref:`space_object:format() <box_space-format>`, then this can be a string for the field 'name'.
1555+
15531556
:param space_object space_object: an :ref:`object reference
15541557
<app_server-object_reference>`
15551558
:param scalar/table key: primary-key field values, must be passed as a
15561559
Lua table if key is multi-part
15571560
:param string operator: operation type represented in string
1558-
:param number field_no: what field the operation will apply to. The
1559-
field number can be negative, meaning the
1560-
position from the end of tuple.
1561-
(#tuple + negative field number + 1)
1561+
:param number-or-string field_identifier: what field the operation will apply to.
15621562
:param lua_value value: what value will be applied
15631563

15641564
:return: the updated tuple.
@@ -1657,13 +1657,13 @@ Below is a list of all ``box.space`` functions and members.
16571657

16581658
.. _box_space-upsert:
16591659

1660-
.. method:: upsert({tuple}, {{operator, field_no, value}, ...}, )
1660+
.. method:: upsert({tuple}, {{operator, field_identifier, value}, ...}, )
16611661

16621662
Update or insert a tuple.
16631663

16641664
If there is an existing tuple which matches the key fields of ``tuple``, then the
16651665
request has the same effect as :ref:`space_object:update() <box_space-update>` and the
1666-
``{{operator, field_no, value}, ...}`` parameter is used.
1666+
``{{operator, field_identifier, value}, ...}`` parameter is used.
16671667
If there is no existing tuple which matches the key fields of ``tuple``, then the
16681668
request has the same effect as :ref:`space_object:insert() <box_space-insert>` and the
16691669
``{tuple}`` parameter is used. However, unlike ``insert`` or
@@ -1676,10 +1676,7 @@ Below is a list of all ``box.space`` functions and members.
16761676
:param table/tuple tuple: default tuple to be inserted, if analogue
16771677
isn't found
16781678
:param string operator: operation type represented in string
1679-
:param number field_no: what field the operation will apply to. The
1680-
field number can be negative, meaning the
1681-
position from the end of tuple.
1682-
(#tuple + negative field number + 1)
1679+
:param number field_identifier: what field the operation will apply to
16831680
:param lua_value value: what value will be applied
16841681

16851682
:return: null

doc/2.2/book/box/box_tuple.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,12 +529,12 @@ Below is a list of all ``box.tuple`` functions.
529529
Update a tuple.
530530

531531
This function updates a tuple which is not in a space. Compare the function
532-
:extsamp:`box.space.{*{space-name}*}:update({*{key}*}, {{{*{format}*}, {*{field_no}*}, {*{value}*}}, ...})`
532+
:extsamp:`box.space.{*{space-name}*}:update({*{key}*}, {{{*{format}*}, {*{field_identifier}*}, {*{value}*}}, ...})`
533533
which updates a tuple in a space.
534534

535-
For details: see the description for ``operator``, ``field_no``, and
535+
For details: see the description for ``operator``, ``field_identifier``, and
536536
``value`` in the section :ref:`box.space.space-name:update{key, format,
537-
{field_number, value}...) <box_space-update>`.
537+
{field_identifier, value}...) <box_space-update>`.
538538

539539
If the original tuple comes from a space that has been formatted with a
540540
:ref:`format clause <box_space-format>`, the formatting will be

0 commit comments

Comments
 (0)