Closed
Description
Related dev issue: tarantool/tarantool#7356
Product: Tarantool
Since: 3.0
Root document:
- https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_index/parts/
- https://www.tarantool.io/en/doc/latest/reference/reference_lua/key_def/
SME: @ Gumix
Details
index_object.parts
has the following methods: extract_key()
, compare()
, compare_with_key()
, merge()
.
For their description and usage examples, refer to Module key_def.
index_object.parts
can be used like a key_def module instance for calling
the corresponding methods. Example:
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}))
The code above is equivalent to:
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}))
Requested by @ Gumix in tarantool/tarantool@55295f5.