Skip to content

Commit f7deeb8

Browse files
authored
Updates description of box_index.parts with new methods (#5126)
* Updates description of ```box_index.parts``` with new methods * Since version 3.0.0 the ```box_index.parts``` can use methods of ```key_def``` Fixes #3444
1 parent 7d73175 commit f7deeb8

File tree

1 file changed

+29
-2
lines changed
  • doc/reference/reference_lua/box_index

1 file changed

+29
-2
lines changed

doc/reference/reference_lua/box_index/parts.rst

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,41 @@
11
.. _box_index-parts:
22

33
===============================================================================
4-
index_object:parts
4+
index_object.parts
55
===============================================================================
66

77
.. class:: index_object
88

99
.. data:: parts
1010

11-
The index's key parts.
11+
The index's key parts.
12+
Since version :doc:`3.0.0 </release/3.0.0>`, the ``index_object.parts`` can operate methods
13+
:ref:`extract_key() <key_def-extract_key>`,
14+
:ref:`compare() <key_def-compare>`,
15+
:ref:`compare_with_key() <key_def-compare_with_key>`,
16+
:ref:`merge() <key_def-merge>`.
17+
18+
**``index_object.parts`` example**
19+
20+
.. code-block:: lua
21+
22+
box.schema.space.create('T')
23+
i = box.space.T:create_index('I', {parts={3, 'string', 1, 'unsigned'}})
24+
box.space.T:insert{1, 99.5, 'X', nil, 99.5}
25+
i.parts:extract_key(box.space.T:get({'X', 1}))
26+
27+
**``key_def`` equivalent**
28+
29+
.. code-block:: lua
30+
31+
key_def = require('key_def')
32+
box.schema.space.create('T')
33+
i = box.space.T:create_index('I', {parts={3, 'string', 1, 'unsigned'}})
34+
box.space.T:insert{1, 99.5, 'X', nil, 99.5}
35+
k = key_def.new(i.parts)
36+
k:extract_key(box.space.T:get({'X', 1}))
37+
38+
The outcome of the methods calling is described in :ref:`key_def_object <key_def_object>`.
1239

1340
:rtype: table
1441

0 commit comments

Comments
 (0)