progaudi / progaudi.tarantool

.net connector for Tarantool NoSql database.
MIT License
48 stars 16 forks source link

byte[] data type #129

Closed MGEHub closed 6 years ago

MGEHub commented 6 years ago

How an array[] data type can be defined and which data type does it match on db side?

aensidhe commented 6 years ago

What do you mean by "array[] data type"? Just use .net arrays, they would be serialized as array in msgpack and stored as arrays in db. The only way to index them is RTREE index, AFAIK. And it's limited to array of int or doubles (coordinates).

MGEHub commented 6 years ago

Sorry, byte[] I intend to

aensidhe commented 6 years ago

You just use byte[], it will be serialized as Binary data type into msgpack and will be saved as single binary field into database. You'll be able to treat it like a lua string, I think. I didn't check, sorry.

MGEHub commented 6 years ago

I checked. it didn't. what should I define the type of field in db? Is it 'string' or 'array'?

aensidhe commented 6 years ago

Please, provide code you use and versions of connector and tarantool.

MGEHub commented 6 years ago

connector: 0.11.0 tarantool: 1.7.6-11-gcd17b77f9 code: [MsgPackArrayElement(0)] public byte[] Field1 { get; set; }

db: box.space.some_space:format({ {name='Field1', type='array'} })

aensidhe commented 6 years ago

Type "array" has meaning only for int[] to represent some geometric coordinates. https://tarantool.io/en/doc/1.7/book/box/data_model.html#data-types

For storing byte[] I would skip datatype or set it to string.

MGEHub commented 6 years ago

Skipping datatype did the trick, thanks.