tuple_object:format()
-
object
tuple_object¶ -
tuple_object:format()¶ Get the format of a tuple. The resulting table lists the fields of a tuple (their names and types) if the
formatoption was specified during the tuple creation. Otherwise, the return value is empty.Return: the tuple format. Rtype: table Note
tuple_object.format()is equivalent tobox.tuple.format(tuple_object).Example:
A formatted tuple:
tarantool> f = box.tuple.format.new({{'id', 'number'}, {'name', 'string'}}) --- ... tarantool> ftuple = box.tuple.new({1, 'Bob'}, {format = f}) --- ... tarantool> ftuple:format() --- - [{'name': 'id', 'type': 'number'}, {'name': 'name', 'type': 'string'}] ... tarantool> box.tuple.format(ftuple) --- - [{'name': 'id', 'type': 'number'}, {'name': 'name', 'type': 'string'}] ...
A tuple without a format:
tarantool> tuple1 = box.tuple.new({1, 'Bob'}) -- no format --- ... tarantool> tuple1:format() --- - [] ... tarantool> box.tuple.format(tuple1) --- - [] ...
-