Skip to content

Updates description of box_index:parts with new methods #5126

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 3 commits into from
May 23, 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
31 changes: 29 additions & 2 deletions doc/reference/reference_lua/box_index/parts.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
.. _box_index-parts:

===============================================================================
index_object:parts
index_object.parts
===============================================================================

.. class:: index_object

.. data:: parts

The index's key parts.
The index's key parts.
Since version :doc:`3.0.0 </release/3.0.0>`, the ``index_object.parts`` can operate methods
:ref:`extract_key() <key_def-extract_key>`,
:ref:`compare() <key_def-compare>`,
:ref:`compare_with_key() <key_def-compare_with_key>`,
:ref:`merge() <key_def-merge>`.

**``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}))

**``key_def`` equivalent**

.. 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}))

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

:rtype: table

Expand Down