Closed
Description
Product: Tarantool
Since: 3.0
Root document:
- https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/format/
- https://www.tarantool.io/en/doc/latest/concepts/data_model/value_store/
SME: @ Gumix
Details
The format clause contains, for each field, a definition within braces:
{name='...',type='...'[,is_nullable=...][,default=...]}
, where:
- the optional
default
value contains a default value for the field.
Its type must be compatible with the field type. If default value is set,
it is applied regardless of whetheris_nullable
is true or false.
Example:
tarantool> box.space.tester:format{
> {name = 'id', type = 'unsigned'},
> {name = 'name', type = 'string', default = 'Noname'},
> {name = 'pass', type = 'string'},
> {name = 'shell', type = 'string', default = '/bin/sh'}}
---
...
tarantool> box.space.tester:insert{1000, nil, 'qwerty'}
---
- [1000, 'Noname', 'qwerty', '/bin/sh']
...
Requested by @Gumix in tarantool/tarantool@7da5f06.
Definition of Done:
- Add new option in the reference section
- Update concepts section