-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Labels
add details[nature] More details needed, some info missing. Documentation is incomplete.[nature] More details needed, some info missing. Documentation is incomplete.exampleProblem with a code example.Problem with a code example.server[area] Task relates to Tarantool's server (core) functionality[area] Task relates to Tarantool's server (core) functionality
Description
Product: Tarantool
Audience/target: developers
Root document: https://www.tarantool.io/en/doc/latest/book/box/data_model/
SME: ?
This might lead to restructuring the Indexes section, which is a separate task.
"How to save and load binary fields" is a frequently asked question by customers. There are no mentions of the right ways of using varbinary fields in the documentation.
An example of example:
tarantool> box.schema.create_space('test')
---
- engine: memtx
before_replace: 'function: 0x010c252e98'
on_replace: 'function: 0x010c252e60'
ck_constraint: []
field_count: 0
temporary: false
index: []
is_local: false
enabled: false
name: test
id: 512
- created
...
tarantool> box.space.test:create_index('primary', {unique=true, parts = {1, 'unsigned'}})
---
- unique: true
parts:
- type: unsigned
is_nullable: false
fieldno: 1
id: 0
space_id: 512
type: TREE
name: primary
...
tarantool> mp = require'msgpack'
---
...
tarantool> s = '\xc4\10aaaabbbbccccdddd'
---
...
tarantool> m = mp.encode(s)
---
...
tarantool> box.space.test:insert({1, m})
---
- [1, !!binary ssQKYWFhYWJiYmJjY2NjZGRkZA==]
...
tarantool> dg = require'digest'
---
...
tarantool> dg.base64_decode(mp.decode(box.space.test:select(1)[1][2]))
---
- !!binary aaaabbbbccccdddd
...
Also more information about using indexes with binary fields, limitations and typical patterns will be nice. The example above may need some beautification.
olegrok
Metadata
Metadata
Assignees
Labels
add details[nature] More details needed, some info missing. Documentation is incomplete.[nature] More details needed, some info missing. Documentation is incomplete.exampleProblem with a code example.Problem with a code example.server[area] Task relates to Tarantool's server (core) functionality[area] Task relates to Tarantool's server (core) functionality