tuple_object:transform()
tuple_object
If t is a tuple instance,
t:transform({start-field-number},{fields-to-remove}) will return a tuple where, starting from field
start-field-number, a number of fields (fields-to-remove) are
removed. Optionally one can add more arguments after fields-to-remove
to indicate new values that will replace what was removed.
If the original tuple comes from a space that has been formatted with a format clause, the formatting will not be preserved for the result tuple.
Parameters:
-
start-field-number(integer) — base 1, may be negative -
fields-to-remove(integer) — none -
field-value(s)(lua-value) — none
Returns
tuple
Return type
tuple
In the following example, a tuple named t is created and then,
starting from the second field, two fields are removed but one new one
is added, then the result is returned.
tarantool> t = box.tuple.new{'Fld#1', 'Fld#2', 'Fld#3', 'Fld#4', 'Fld#5'}---...tarantool> t:transform(2, 2, 'x')---- ['Fld#1', 'x', 'Fld#4', 'Fld#5']...