Skip to content

Document default field values #3520

Closed
@TarantoolBot

Description

@TarantoolBot

Product: Tarantool
Since: 3.0
Root document:

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 whether is_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

Metadata

Metadata

Assignees

Labels

3.0featureA new functionalityreference[location] Tarantool manual, Reference part

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions