Skip to content

Adds new methods to index_object_parts #5140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions doc/reference/reference_lua/box_index/parts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,31 @@ index_object.parts
:ref:`compare_with_key() <key_def-compare_with_key>`,
:ref:`merge() <key_def-merge>`.

Since version :doc:`3.1.0 </release/3.1.0>`, the ``index_object.parts`` can operate methods
:ref:`validate_key() <key_validate_key>`,
:ref:`validate_full_key() <key_validate_full_key>`,
:ref:`validate_tuple() <key_validate_tuple>`,
:ref:`compare_keys() <key_compare_keys>`.

**``index_object.parts`` example**

.. code-block:: lua

box.schema.space.create('T')
i = box.space.T:create_index('I', {parts={3, 'string', 1, 'unsigned'}})
box.space.T:insert{1, 99.5, 'X', nil, 99.5}
i.parts:extract_key(box.space.T:get({'X', 1}))
box.schema.space.create('T')
i = box.space.T:create_index('I', {parts={3, 'string', 1, 'unsigned'}})
box.space.T:insert{1, 99.5, 'X', nil, 99.5}
i.parts:extract_key(box.space.T:get({'X', 1}))

**``key_def`` equivalent**

.. code-block:: lua
.. code-block:: lua

key_def = require('key_def')
box.schema.space.create('T')
i = box.space.T:create_index('I', {parts={3, 'string', 1, 'unsigned'}})
box.space.T:insert{1, 99.5, 'X', nil, 99.5}
k = key_def.new(i.parts)
k:extract_key(box.space.T:get({'X', 1}))
key_def = require('key_def')
box.schema.space.create('T')
i = box.space.T:create_index('I', {parts={3, 'string', 1, 'unsigned'}})
box.space.T:insert{1, 99.5, 'X', nil, 99.5}
k = key_def.new(i.parts)
k:extract_key(box.space.T:get({'X', 1}))

The outcome of the methods calling is described in :ref:`key_def_object <key_def_object>`.

Expand Down