tuple_object:update()
tuple_object
Update a tuple.
This function updates a tuple which is not in a space. Compare the
role="extsamp"} which updates a tuple in a space.
For details: see the description for operator, field_no, and value
in the section [format clause](../../box_space/update#box_space-update {params[]}.
If the original tuple comes from a space that has been formatted with a {linkto(../../box_space/format), the formatting will be preserved for the result tuple.
Parameters:
-
operator(string) — operation type represented in string (e.g. '=' for 'assign new value') -
field_no(number) — what field the operation will apply to. The field number can be negative, meaning the position from the end of tuple. (#tuple + negative field number + 1) -
value(lua_value) — what value will be applied
Returns
new tuple
Return type
tuple
In the following example, a tuple named t is created and then its
second field is updated to equal 'B'.
tarantool> t = box.tuple.new{'Fld#1', 'Fld#2', 'Fld#3', 'Fld#4', 'Fld#5'}---...tarantool> t:update({{'=', 2, 'B'}})---- ['Fld#1', 'B', 'Fld#3', 'Fld#4', 'Fld#5']...
Since Tarantool 2.3 a tuple can also be updated via JSON paths.