Skip to content

Document field names changes #317

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

Closed
rtsisyk opened this issue Oct 11, 2017 · 0 comments
Closed

Document field names changes #317

rtsisyk opened this issue Oct 11, 2017 · 0 comments
Assignees

Comments

@rtsisyk
Copy link
Contributor

rtsisyk commented Oct 11, 2017

  1. space:format() syntax was extended.

In addition to current syntax of space fileds format definition:

  • space:format({{name='field_id', type='integer'}, ...})

Add more ways to define it:

  • space:format({{'field_name', 'integer'}, ...})
  • space:format({{'field_name', type='integer'}, ...})
  • space:format({{'field_name'}, ...})
  • space:format({'field_name', ...})

tarantool/tarantool#2814

  1. index_parts syntax was extended

Add new method of defining indexes:

  • parts = { {field = field_name1, type = field_type}, {field = field_name2, type = field_type}, ...}
  • parts = { {field_name1, field_type}, {field_name2, field_type}, ...}
  • parts = { {field_name1}, {field_name2}, ...}
  • parts = {field_name1, field_name2}
  • parts = {field_id, field_id}

Now you can use both field numbers and field names from space:format() to define indexes.

tarantool/tarantool#2802
tarantool/tarantool#2815

  1. Field names from space:format() now can be used as aliases for tuple field indexes:
subscriber = box.schema.space.create('subscriber')
subscriber:format({
    {'contract_id', 'integer'},
    {'subscriber_id', 'integer'},
    {'phone', 'string'},
    {'subscriber_status_id', 'integer'},
})
subscriber:create_index('primary', {parts={'contract_id', 'subscriber_id'}})
subscriber:create_index('phone', {parts={'phone'}, unique = false })

tarantool> subscriber:replace({1, 1, '79160000000', 42})
---
- [1, 1, '79160000000', 42]
...

tarantool> t = subscriber:get({1, 1})
---
...

tarantool> t.subscriber_id
---
- 1
...

tarantool> t.phone
---
- '79160000000'
...

tarantool/tarantool#1014

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

No branches or pull requests

2 participants