Skip to content

Add default values docs #4371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 22, 2024
Merged

Add default values docs #4371

merged 6 commits into from
Jul 22, 2024

Conversation

p7nov
Copy link
Contributor

@p7nov p7nov commented Jul 18, 2024

Resolves #3520 #3617

Add default values documentation:

Deployment: https://docs.d.tarantool.io/en/doc/gh-3520-default-values-funcs/concepts/data_model/value_store/#default-values

@p7nov p7nov requested a review from Gumix July 19, 2024 05:23
@p7nov p7nov requested a review from andreyaksenov July 22, 2024 03:54
--------------

*Default values* are assigned to tuple fields automatically if these fields are
skipped during the tuple insert or update.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


To change the default values, call ``space_object.format()`` again.

To use a default value for a field, skip it or assign `nil`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd place this snippet right after the books:format definition. And then we can tell about more specific things.

books:format({
{ name = 'id', type = 'unsigned' },
{ name = 'isbn', type = 'string' },
{ name = 'title', type = 'string', default = 'No title specified' },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea: as we talk about default functions here, we can remove the default parameter for title to simplify the example a bit.

p7nov and others added 2 commits July 22, 2024 17:27
Co-authored-by: Andrey Aksenov <38073144+andreyaksenov@users.noreply.github.com>
@p7nov p7nov merged commit 163b69c into latest Jul 22, 2024
1 check passed
@p7nov p7nov deleted the gh-3520-default-values-funcs branch July 22, 2024 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document default field values
3 participants